在终端中输入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 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.
现在我的新用户帐户一切正常。
ANDROID_SDK_HOME是指向根目录的指针。该文件默认创建在“C:\Users\name\. android”目录下。android”,而不是你的SDK文件夹的根目录。然后:
—将ANDROID_SDK_HOME分配到SDK根文件夹将无效。
-如果你的路”。“android”文件有非ascii字符,它将无法工作。
- AVD文件夹必须在您当前的”。android”文件。
所以答案是:
Change your SDK folder, if you need, like the previous answers (inside the project on Android Studio).
Close Android Studio.
Control Panel > System > Advanced System Settings > Environment Variables.
Add a new User variable:
Variable Name: ANDROID_SDK_HOME
Variable Value: C:\src (or any folder that has not problems with non-ASCII characters or S.O. privileges)
THE PATH THAT YOU WILL ENTER CANNOT BE ROOT FOLDER OF YOUR ANDROID SDK!!!
Open Android Studio. Make sure a folder called ".android" was created in your new location.
Delete the Android Virtual Device (AVD) that you created.
Close and open Android Studio.
Create a new AVD and see the magic happens.
欢呼。