Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cordova requirements error "Android target: not installed"

Using cordova on WINDOWS 10 I'm not able to build project.

When I tried cordova requirements it shows me Android target: not installed.

I tried all possible solutions over internet and SO, however, none worked for me. Probably this is related to the latest version of cordova v 8.0.0.

I tried the following which did NOT work:
1. overwriting tools folder from cordova CLI in my C:\Users\admin\AppData\Local\Android\Sdk folder.
2. cordova platform remove android and then cordova platform add [email protected]
3. Uninstalling and reinstalling all SDKs in Android Studio.
4. <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="26" />
5. Updated config.xml file with

<platform name="android">

  <preference name="android-minSdkVersion" value="16"/> 
  <preference name="android-targetSdkVersion" value="26"/>

  <!--other line code -->

</platform>
  1. Installed all SDK from SDK manager in Android Studio from 16 to 27.

Following is the log after firing the requirements command:

Android Studio project detected

Requirements check results for android:
Java JDK: installed
Android SDK: installed true
Android target: not installed
cmd: Command failed with exit code 1 Error output:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
        at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
        at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
        at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
        at com.android.sdklib.tool.AvdManagerCli.parseSdk(AvdManagerCli.java:328)
        at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:204)
        at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:195)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
        ... 6 more
Gradle: installed

Please suggest a solution to fix this issue.

like image 548
Temp O'rary Avatar asked Apr 29 '18 20:04

Temp O'rary


1 Answers

Finally I fixed it! I downgraded my JDK to version 8.172. Seems like JDK version above 8 is not supported by Android SDK. Then, update your JAVA_HOME path in the Environment Variables to point to the new JDK folder path. If you are using Mac or *nix boxes, you may also try jenv as well (I could not try jenv, but let me know if it did work for you)

like image 55
Temp O'rary Avatar answered Sep 30 '22 11:09

Temp O'rary