Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.2k views
in Technique[技术] by (71.8m points)

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:UsersadminAppDataLocalAndroidSdk 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...