问题
After following the instructions for setting up Cordova for Android development on the Cordova documentation, I encountered this error:
Error: No emulator images (avds) found.
1. Download desired System Image by running: /Users/Jacob/Library/Android/sdk/tools/android sdk
2. Create an AVD by running: /Users/Jacob/Library/Android/sdk/tools/android avd
HINT: For a faster emulator, use an Intel System Image and install the HAXM device driver
Every other post I found only said to add an emulator, but I have already done that. In Android Studio, I have in fact made three!
It is also worth mentioning that Cordova used to be able to run the emulator, but in attempting to fix another problem, I ran into this one. I did run into a problem with permissions, and now have to use sudo
every time I run a Cordova command. Could that have anything to do with it?
Here is my .bash_profile:
ANDROID_HOME=/Users/Jacob/Library/Android/sdk
PATH=${PATH}:/Users/Jacob/Library/Android/sdk/platform-tools:/Users/Jacob/Library/Android/sdk/tools
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
I have been trying to use the Android API level 23 with Android 5.1.1 in Cordova.
After trying everything I could think of (as a Terminal newbie :p), I'm out of ideas. I have tried reinstalling the Android SDK with all the packages, node.js (perhaps not entirely cleaning log files/caches), and Cordova, but to no avail. Is there anything in particular I could just reinstall so that the problem would probably disappear without much fixing?
Thanks!
回答1:
I have a similar issue and have found one way around it.
Try opening your Android SDK manager > tools > Manage SDKs...
Select an AVD and click start. Once booted, try the comment cordova run android
(with sudo if necessary) and it should work on the running emulator.
When debugging, I find it much better to plug in an actual device - the experience is much smoother and you get better feel for what the app actually looks and runs like on a real device, whereas on the SDK emulator Cordova often runs quite slowly.
You can find instructions for that here.
回答2:
Got it! After some messing around, I found two files:
/Users/Jacob/.config/configstore/update-notifier-cordova.json
/Users/Jacob/.config/configstore/update-notifier-phonegap.json
By pressing CMD+I
, I could see that their permissions did not include the admin (my name). So after adding my name to their permissions, I don't have to use sudo
nearly as much and the emulator worked perfectly! :)
回答3:
what you mean by 'I have been trying to use the Android API level 23 with Android 5.1.1' ?
Api 23 = marshmallow = android 6
You must have updated cordova i guess.i use ionic i got this after updating cordova and ionic.
either dcrease the target sdk in manifest or download latest system-image/sdk for api 23. since cordova/equivalent framework will always try building with latest api level.
for now you can try changing target sdk in manifest.config.xml
来源:https://stackoverflow.com/questions/36724018/cordova-not-finding-avd