Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cordova requirements issue , android target not installed

I am trying to install Cordova on windows 7. I am following this tutorial : https://www.tutorialspoint.com/cordova/cordova_first_application.htm

while I run cordova requirements, it says android target is not intalled and set the ANDROID_HOME environment variable

I:\CordovaProject\hello>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

I:\CordovaProject\hello>echo %ANDROID_HOME%
C:\Users\user\AppData\Local\Android\sdk

as you can see in the image 1, when I echo ANDROID_HOME it is set to proper location. I am not able to resolve this error. kindly help me with this

path has these : %ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools

I have downloaded android-25 in android studio

and project properties file has android target set to : android-25 both in I:\CordovaProject\hello\platforms\android\CordovaLib\project.properties
I:\CordovaProject\hello\platforms\android\project.properties

and when i run cordova build android i get following error

BUILD FAILED

Total time: 31.807 secs
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
 > Could not resolve all dependencies for configuration ':classpath'.
 > Could not download uast.jar (com.android.tools.external.com-
 intellij:uast:145.597.3)
  > Could not get resource 'https://jcenter.bintray.com/com/android/tools/ex
 ternal/com-intellij/uast/145.597.3/uast-145.597.3.jar'.
     > Could not GET 'https://jcenter.bintray.com/com/android/tools/external
  /com-intellij/uast/145.597.3/uast-145.597.3.jar'.
        > akamai.bintray.com

  * Try:
   Run with --stacktrace option to get the stack trace. Run with --info or -
   -debug   option to get more log output.
like image 943
user6694839 Avatar asked Apr 17 '17 09:04

user6694839


2 Answers

For SDK 21 ("android-21")

$ cordova platform remove android
$ cordova platform add [email protected]

For SDK 22 (Android 4.1.1, "android-22")

$ cordova platform remove android
$ cordova platform add [email protected]
like image 179
Elialber Lopes Avatar answered Sep 28 '22 00:09

Elialber Lopes


I found the same issue and fix it!

Its related to Java path in JAVA_HOME and Path Variable should contain the same path with Android Studio (JRE folder). You may found this info in Android Studio, SDK Location.

After Change my Path and JAVA_HOME variable (go to control panel, system and security, system, environment variable) update Path and JAVA_HOME variable to C:\Program Files\Android\Android Studio\jre.

More detail... JAVA_HOME contains C:\Program Files\Android\Android Studio\jre and Path contains C:\Program Files\Android\Android Studio\jre\bin

checking requirements all good !

cordova requirements

like image 35
Lucky Pangemanan Avatar answered Sep 28 '22 00:09

Lucky Pangemanan