在终端中输入cordova运行android后,我得到了这个错误:

Waiting for emulator to start...
PANIC: Broken AVD system path. Check your ANDROID_SDK_ROOT value [/Users/username/Library/Android/sdk]!

这发生在导出之后:

export ANDROID_SDK_ROOT='/Users/username/Library/Android/sdk'

在导出之前,我得到:

Waiting for emulator to start...
PANIC: Cannot find AVD system path. Please define ANDROID_SDK_ROOT

你知道我哪里错了吗?我确定这是sdk根,所以为什么我得到破碎的avd系统路径?


当前回答

在尝试了一段时间的其他谷歌“解决方案”后,唯一对我有用的是,在Windows上设置ANDROID_SDK_ROOT环境变量,并添加和删除ANDROID_HOME和ANDROID_SDK_HOME变量后,是Xerox23的答案-编辑AVD的config.ini将ANDROID_SDK_ROOT的值硬编码到image.sysdir中。1房地产。

这是使用Android Studio 3.0.1和模拟器26.1.4,从Android Studio内的AVD管理器启动虚拟设备。

其他回答

我也有同样的问题。我删除了。android/avd文件夹中的图像模拟器,在我安装lib32stdc++6后:

sudo apt-get install lib32stdc++6

所以,它起作用了!魔法吗?

我的Windows10也有同样的问题, 通过以下步骤解决了我的问题。 开放Android Studio -工具 - SDK管理器 -复制Android SDK位置 Android SDK 设置系统环境变量 ANDROID_HOME和ANDROID_SDK_ROOT 系统环境变量

要修复或避免此问题,请确保:

You have an environment variable ANDROID_SDK_ROOT pointing to a root folder of android sdk. You have a correct file structure in the sdk folder. cmdline-tools, emulator, platform-tools, system-images, platforms should be present. If you don't have these folders you should install missing components. emulator is the emulator itself. system-images has iso images of OS to run in the emulator. platforms has platform packages required to compile an app for different APIs. platform-tools has adb and other necessary tools. Without these components the emulator wont start and will post the same error about broken avd path. Make sure that you downloaded through sdkmanager matching api versions of system image and platform. e.g. for API-30 platforms;android-30 and system-images;android-30;default;x86_64. Make sure that your avd devices are located in HOME/.android/avd. If you have custom location for avd devices you should create one more environment variable ANDROID_AVD_HOME pointing to /avd/ folder.

本文提供了所有环境变量的信息,但除了ANDROID_SDK_ROOT和ANDROID_AVD_HOME,你不需要任何其他的环境变量。

误差实际上是不同的。使用-verbose选项运行./emulator很有帮助,因为它会显示实际的错误。

在Windows 10(没有Android Studio)中,我通过传输“PANIC: Broken AVD系统路径”解决了这个问题。android的文件夹从默认位置“C:\Users\Леон”进入SDK文件夹。改变环境

ANDROID_SDK_ROOT=D:\Android\SDK
ANDROID_AVD_HOME=%ANDROID_SDK_ROOT%\.android\avd
ANDROID_EMULATOR_HOME=%ANDROID_SDK_ROOT%\.android   

我认为问题可能是在USER路径中的非ascii符号中,或者它们需要“全部放在一起”。