Cordova cannot see android targets
Hi, everyone.
I have the following error with cordora:
~$ cordova requirements
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed
Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.
Gradle: installed
Error: Some of requirements check failed
But there is at least one target for Android:
~$ $ANDROID_HOME/tools/bin/avdmanager list target
Available Android targets:
----------
id: 1 or "android-25"
Name: Android API 25
Type: Platform
API level: 25
Revision: 3
So, I don't understand what Cordova wants from me.
OS: funtoo stable
Cordova: 6.5.0
Android studio: 162.3871768
source to share
Mailing list answer that helps:
cordova platform add https://github.com/apache/cordova-android#6.2.2
After that run:
cordova platform rm android
cordova platform add https://github.com/apache/cordova-android#6.2.2
cordova build
works. But cordova requirements
also cordova emulate android
show me the error:
Error: android: Command failed with exit code 2
source to share
I had the same problem and it took me a while to figure it out. I am using ubuntu 16.04 with Android Studio 2.3.1 and latest cordora to date and got the same issue. I registered the solution here , but here's the short answer:
Android SDK changed the command android
to avdmanager
, but cordova is still trying to use the first one when detecting Android targets. To fix this, find the file:
path_to_your_app/platforms/android/cordova/lib/check_reqs.js
and find the following around line ~ 249:
return tryCommand('android list targets --compact', msg)
and change it to:
return tryCommand('avdmanager list targets --compact', msg)
And this! In my case, this was enough to solve the problem.
source to share