运行Ionic Cordova模拟android时,Android Studio AVD未显示在终端中

时间:2019-01-17 21:05:14

标签: android cordova android-studio ionic-framework avd

我有一个在Android Studio中创建的AVD,下面是它的详细信息:

https://i.imgur.com/CapOPE3.png

当我在离子项目中运行ionic cordova emulate android时,出现此错误:

ANDROID_HOME=/Users/joshterrill/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home
Error: No emulator images (avds) found.
1. Download desired System Image by running: /Users/joshterrill/Library/Android/sdk/tools/android sdk
2. Create an AVD by running: /Users/joshterrill/Library/Android/sdk/tools/android avd
HINT: For a faster emulator, use an Intel System Image and install the HAXM device driver

[ERROR] An error occurred while running cordova emulate android (exit code 1).

当我运行以下命令时:~/Library/Android/sdk/tools/android list avd我得到了:

Joshs-MacBook-Pro:~ joshterrill$ ~/Library/Android/sdk/tools/android list avd
*************************************************************************
The "android" command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
*************************************************************************
Running /Users/joshterrill/Library/Android/sdk/tools/bin/avdmanager list avd

Available Android Virtual Devices:
Joshs-MacBook-Pro:~ joshterrill$ 

所以这并不表明我在那里。

此外,这是Android Studio的屏幕截图,显示了我的SDK当前安装在我要查找AVD的位置:

https://i.imgur.com/ZWJ4rns.png

关于为何未显示AVD的任何想法?我了解到emulate命令显示的第一个错误使我能够从命令行创建AVD,但是我需要从Android Studio创建各种AVD,并且需要弄清楚为什么终端看不到他们。

1 个答案:

答案 0 :(得分:0)

此问题的答案是我的$PATH中包含正确的信息。这就是对我有用的东西:

export ANDROID_HOME=~/Library/Android/sdk
export PATH=${PATH}:/Users/mylaptop/Library/Android/sdk/platform-tools/adb:/Users/mylaptop/Library/Android/sdk/platform-tools:/Users/mylaptop/Library/Android/sdk/tools