在终端中输入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系统路径?


当前回答

为了解决这个问题,我必须使用SDK Manager.exe(在“C:\Program Files (x86)\Android\ Android - SDK”中)安装缺少系统映像的包。我注意到我需要的系统映像(“Android -23”)在“C:\Program Files (x86)\Android\ Android -sdk\system-images”中丢失了。

在运行SDK Manager.exe并安装适当的包后,我可以在Android Studio中运行模拟器。

以下是对我有效的解决方案:

https://www.embarcadero.com/starthere/xe5/mobdevsetup/android/en/creating_an_android_emulator.html

其他回答

对我来说,问题是非ASCII字符在默认路径到AVD,这在我的情况下是:

C:\Users\MY_USER.android\dept

和MY_USER包含非ASCII字符。因此,我不得不移动我的avd到其他位置和设置

ANDROID_AVD_HOME

env变量。

今天刚刚遇到了这个问题,并设法解决了它。

模拟器:[140735565005632]:ERROR:android/android-emu/android/qt/qt_setup.cpp:28: qt library not found at /Users/your_user_name/ library /android/ sdk/ Emulator /lib64/qt/lib

15:08 Emulator: Could not launch '/Users/your_user_name/Library/Android/sdk/ Emulator /qemu/darwin-x86_64/qemu-system-x86_64':没有这样的文件或目录

解决方法非常简单。通过Android Studio => tools => Android => SDK manager => SDK tools => select Android emulator => Apply

我使用的是macOS High Sierra的MacBook Pro,我相信你的机器与此问题无关。在第一次使用Android Studio 3.0.1运行Android Studio安装管理器时,模拟器没有明显安装,至少对我来说是这样

同时,确保你在.bashrc或.zshrc中定义了你的路径,就像这样:

export ANDROID_HOME=/Users/your_user_name/Library/Android/sdk
export ANDROID_SDK_ROOT=$ANDROID_HOME
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools

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

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,你不需要任何其他的环境变量。

我在Windows 10上就遇到过这个问题。 我尝试了几种解决办法,但没有一个奏效。 以下是我解决问题的方法:

Uninstalled Android Studio, SDK, .android and .AndroidStudio folders in %USERPROFILE%, Android folder in %LOCALAPPDATA%. Uninstalled Java. Downloaded latest Java JDK:https://www.oracle.com/technetwork/java/javase/downloads/jdk13-downloads-5672538.html and set PATH Environment Variable: https://docs.oracle.com/en/java/javase/11/install/installation-jdk-microsoft-windows-platforms.html#GUID-96EB3876-8C7A-4A25-9F3A-A2983FEC016A I created new Windows 10 local user using LATIN CHARACTERS with admin priviledges. Switched to the new user and installed Android Studio. When the setup wizard was shown, I selected Custom option and checked Android emulator to be installed. I left all location folders as DEFAULT.

现在我的新用户帐户一切正常。

在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符号中,或者它们需要“全部放在一起”。