Cordova I can not get past "Android target: not installed"

0

I'm trying to use Cordova for the first time but I'm not getting it.

I have already seen the directories the file AndroidManifest.xml and project.properties

In Android Studio I have already installed the Android SDK for platforms 14, 16 and 20 to 27.

I do not know what else to do ...

This is the gift:

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)

Whenaddingandroid:

*AndroidManifest.xmlchangedafter"cordova platform add [email protected]"

    
asked by anonymous 20.03.2018 / 19:12

2 answers

0

I do not think you have added via cordova to your specific project.

First make sure 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, in your androidmanifest.xml the 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 is 7.1.1 as in the image you posted:

Dothis:

[email protected]

Documentation: link

Cordova mount

According to the blog the latest post about android link for now the cord support for Android 7.1.0, but there were no updates for 7.1.1 support (so far 03/20/2018).

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

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

So you'll use Android 7.0 as a 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 in the cordova just edit again and put 25.

    
20.03.2018 / 19:17
0

It already works.

I 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 that's it.

    
21.03.2018 / 17:31