当前位置: 首页 > 知识库问答 >
问题:

线程“main”java.lang.NoClassDefoundError中出现异常:javax/xml/bind/annotation/XMLSchema

洪飞驰
2023-03-14

我正在尝试制作一个cordova插件。我的所作所为

$ 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
[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)

另外,我已经安装了AndroidStudio4.1

共有1个答案

濮宇定
2023-03-14

我降级到Java8,它起作用了。

不知道为什么15在这种情况下不起作用。

 类似资料: