Issue
I am trying to make a cordova plugin. What I did
$ cordova create toasty-plugin-test com.stanleyidesis.toastyplugintest ToastyPluginTest
$ cd toasty-plugin-test
$ cordova platforms add android
$ cordova requirements
[boy@Plum toasty-plugin-test ]$ cordova requirements
Requirements check results for android:
Java JDK: installed 15.0.1
Android SDK: installed true
Android target: not installed
Command failed with exit code 1: avdmanager list target
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.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(BuiltinClassLoader.java:606)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 5 more
Gradle: installed /usr/local/Cellar/gradle/6.7/bin/gradle
Some of requirements check failed
How can I fix this issue?
environment:
macOS - Catalina, 10.15.6
[boy@Plum toasty-plugin-test ]$ which java
/usr/bin/java
[boy@Plum toasty-plugin-test ]$ which javac
/usr/bin/javac
[boy@Plum toasty-plugin-test ]$ java -version
java version "15.0.1" 2020-10-20
Java(TM) SE Runtime Environment (build 15.0.1+9-18)
Java HotSpot(TM) 64-Bit Server VM (build 15.0.1+9-18, mixed mode, sharing)
Also, I've installed AndroidStudio 4.1
Solution
I downgraded to Java 8 and it worked.
Don't know why 15 doesn't work in this case.
Answered By - Kid
Answer Checked By - Terry (JavaFixing Volunteer)