Cordova can’t outrun "Android target: not installed"

Asked

Viewed 649 times

1

I’m trying to use Cordova for the first time.

I’ve seen the directories the Androidmanifest.xml file and the project.properties file

No Android Studio já instalar os SDK Android para as plataformas 14, 16 e da 20 a 27.

I don’t know what else to do...

This is the give:

C:\Android\Cordova\hello>cordova requirements
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/annota
tion/XmlSchema
        at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(Sc
hemaModule.java:156)
        at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
        at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHa
ndler.java:81)
        at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:213)
        at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema

        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinCla
ssLoader.java:582)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(C
lassLoaders.java:185)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
        ... 5 more
Gradle: installed C:\Program Files\Android\Android Studio\gradle\gradle-4.1\bin\
gradle
(node:6696) UnhandledPromiseRejectionWarning: CordovaError: Some of requirements
 check failed
    at C:\Users\julio\AppData\Roaming\npm\node_modules\cordova\src\cli.js:414:27

    at _fulfilled (C:\Users\julio\AppData\Roaming\npm\node_modules\cordova\node_
modules\cordova-lib\node_modules\q\q.js:787:54)
    at self.promiseDispatch.done (C:\Users\julio\AppData\Roaming\npm\node_module
s\cordova\node_modules\cordova-lib\node_modules\q\q.js:816:30)

Android Studio SDK

Pasta SDK 25

Pasta SDK 27

when adding android:

cordova platform add android@7.0.0

*Androidmanifest.xml changed after "Cordova Platform add [email protected]"

2 answers

0

Already Works.

It had Java JDK 9.0.4 installed and that was the problem.

I installed Java JDK 8u162, I changed the JAVA_HOME variable to the new JDK and it’s gone.

0

I guess you didn’t add via cordova in its specific project.

First check that Cordova is up to date, run the following command:

npm update -g cordova

If it is linux/mac:

sudo npm update -g cordova

Navigate via CMD to the folder, like this:

cd C:\Android\Cordova\hello
cordova platform add android

It may take a while.

If you want to add a specific version of android, for example, on your androidmanifest.xml targetSDK is 25:

<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="25"/>

So you need android 7.1, do this:

cordova platform remove android
cordova platform add [email protected]

If it’s 7.1.1 as in the image you posted:

android sdk manager

Do so:

cordova platform remove android
cordova platform add [email protected]

Documentation: https://cordova.apache.org/docs/en/latest/guide/cli/#add-Platforms


Support of the Cordova

Conforme o blog a ultima postagem sobre android https://cordova.apache.org/announcements/2018/02/26/cordova-android-7.1.0.html for now Cordova support for Android 7.1.0, but there were no updates to support 7.1.1 (so far 20/03/2018).

So the suggestion is to use an older version for the targetSdk, editing on androidmanifest.xml for:

 <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="24"/>

So will use Android 7.0 as target, so in the project run:

cordova platform remove android
cordova platform add android

Or:

cordova platform remove android
cordova platform add [email protected]

When version 7.1.1 is available on Ordova just edit again and put 25.

  • I haven’t added android

  • C: Android Cordova hello>Cordova Platform ls Installed Platforms: android 7.0.0 Available Platforms: browser ~5.0.1 Ios ~4.5.4 osx ~4.0.1 windows ~5.0.0 www 3.12.0

  • @Juliomarcelo like this is your androidmanifest.xml ?

  • C: Android Cordova hello Platforms android Cordovalib

  • <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="25"/>

  • @Juliomarcelo SDK 25 (your target) is for Android 7.1 and not 7.0... a probably vc not installed Android 7.1, or your Cordova is outdated .... Try to remove android cordova platform remove android and then add the specific version to 25 with this command: cordova platform add [email protected]

  • The mistake is the same...

  • @Juliomarcelo checked whether the SDK 25 is properly installed in the SDK Manager or not? Check this and then run the commands cordova platform remove android cordova platform add [email protected] again.

  • @Juliomarcelo try 7.1.1, like this: cordova platform remove android cordova platform add [email protected]

  • When I try to add error 7.1.1

  • @Juliomarcelo "gives error" is generalizing, but what error after all? Give details

  • (Ode:7428) Unhandledpromiserejectionwarning: Cordovaerror: Failed to fetch Plat form [email protected]

  • @Juliomarcelo edited the answer, read the written part Cordova Support: https://answall.com/a/285337/3635 -- after changing androidmanifest do not forget to run the commands to use version 7.0.0 (api level 24)

  • also not given already added image

  • I put the image on top with what I did, I did the remove after I did the add, then I changed the manifest and in the end I did the Resuscitations and the error is in the image in my initial post, I also already changed target=android-24 in the project properties.

  • That’s it. I had java jdk-9.0.4 installed, installed jdk1.8.0_162 and redirected java_home there. Everything is working right now.

Show 11 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.