在终端中输入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操作系统,但这个线程是谷歌的第一个结果,也是这个问题的主要结果,所以:

使用windows 10并在使用Flutter时收到此错误消息,此命令起作用:

echo $ANDROID_HOME && flutter doctor -v

其他回答

中国的小伙伴注意!原因是avd目录不能包含中文 上面这些方法我都试过了,还是报错,不知道是不是我的avd目录里有汉字。所以我改变默认的avd目录通过以下步骤,它工作。 1. 创建一个路径不包含非ascii字符的文件夹 2. 复制或剪切默认的avd文件夹$HOME/。Android在你刚刚创建的文件夹下面 3.添加PATH ADNDROID_SDK_HOME, Android工作室会在$ADNDROID_SDK_HOME/.android/avd下面找到avd

终于成功了!:>

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

模拟器:[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

删除使用Homebrew Android SDK作为默认SDK时的错误

和@ freak一样,我用homebrew (mac的包管理器)安装了android-sdk。我需要执行下面的操作来修复这个错误,因为我在遵循nativescript教程时遇到了这个错误。如果你像我一样打算使用android-sdk版本的brew版本使用这个答案(这将允许你使用nativescripts tns运行android api),如果你想要android工作室默认的android-sdk遵循@ freak的答案。

配置Android Studio以使用Homebrew的Android SDK

基本上你只需要在Android studio中更改Android SDK的位置。首先在android studio中打开一个项目。然后点击这个按钮打开SDK管理器。

接下来,当android SDK管理器的默认首选项出现时,你需要单击android SDK位置旁边的编辑。

查找Homebrew的Android SDK的位置

接下来,你需要在sdk组件设置屏幕上更新sdk位置,我的brew android-sdk位于这里/usr/local/share/android-sdk。你可以通过运行brew cask info android-sdk来找到你的安装位置,然后在输出的底部应该说:

You can control android sdk packages via the sdkmanager command.
You may want to add to your profile:

  'export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"'

导出的ANDROID_SDK_ROOT变量的值(这里是/usr/local/share/android-sdk)是自制的android sdk的位置。

然后点击“Android SDK Location”按钮(图中标记为1),粘贴Homebrew的Android SDK位置。

然后通过安装任何包来完成向导。在这一步中,我需要删除并重新创建我的设备模拟器,但在那之后,它似乎工作得很好。

设置Android SDK环境变量指向Homebrew的Android SDK

Also you may want to make sure if you are going the Homebrew route that your profile settings script has the ANDROID_HOME and ANDROID_SDK_ROOT environment variables set to your Homebrew location of the android sdk otherwise the above won't work yet. This can get changed from the Homebrew location if you installed Homebrew before installing Android Studio as pointed out in this answer by @Jamie Armour. You can check the environment variables for the android sdk are set correctly by running echo $ANDROID_HOME and echo $ANDROID_SDK_ROOT and verifying that they both show the Homebrew location of the android sdk.

如果你需要更改ANDROID_HOME和ANDROID_SDK_ROOT值,你可以在Mac的配置文件设置中这样做,可能在~/中。~ / bash_profile。”Bashrc”,或者“~/”。并定义如下:

export ANDROID_HOME="/usr/local/share/android-sdk"
export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"

You need to change the values of both the exports to the proper values of Homebrew's android SDK location then save the file. To verify that the right values have been written you should first either close and open your terminal which should rerun the file and reset the environment variables or you can source the file by running source <profile file name> where is the profile file you edited and saved. You then can rerun echo $ANDROID_HOME and echo $ANDROID_SDK_ROOT to verify that they have the Homebrew android sdk location.

为了解决这个问题,我必须使用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

在Mac OS X上,我也遇到了同样的问题。我无法从Visual Studio中启动Xamarin应用程序,但Android Studio中的原生Java Android项目在虚拟设备中可以运行。

我所做的是:

取消设置ANDROID_HOME和ANDROID_SDK_ROOT环境变量。

unset ANDROID_HOME
unset ANDROID_SDK_ROOT

移除已经崩溃的虚拟设备。我是在Visual Studio中完成的。 创建新的虚拟设备。