i just started to make my first native cordova app from cordova official tutorial, and when I run
ayam@laptop:~/Documents/learn/hello$ cordova requirements
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed
*** avdmanager: Command failed with exit code 1
Gradle: installed /usr/local/gradle-3.5/bin/gradle
Error: Some of requirements check failed
I got avdmanager: Command failed with exit code 1
Android tools might not be added with the correct path:
I solved it by doing this in macOS terminal:
These are all the required path variables by Cordova.
Important:
Make sure that there is a folder called
/Android/
inside your user folder insideLibrary
!It used to be installed directly to the user folder instead of in
Library
so therefor the confusion.Also part of the problem could be your JAVA version or JAVA_HOME path:
Check if your JAVA path variable is set up properly:
If you see nothing that means your
$JAVA_HOME
variable is not exported properly.You need to use JAVA SE v 1.8 for Cordova to work. Do first:
and check if that version is available or not. If not you can research how to install it in there with homebrew. If it is available make sure the correct JAVA_HOME variable path is set. Do this like so:
This problem arises when there is no virtual device set up in the system (No target version or no target device). I am not sure if that is a must. You can add a device using SDK manager.
In SDK manager, Add an android repository (For example - Android 5.0.1 API 21) and all dependencies like SDK Tools etc.
Then try cordova requirements. If you are able to run an instance of emulator then this error will go off..(It worked for me that way!)
Hope this helps..