Java-11中的'cordova run'失败

lqfhib0f  于 2023-10-24  发布在  Java
关注(0)|答案(1)|浏览(157)

我正在使用cordova 12.0.0OpenJDK-11grade-7.5.1cordova build工作,我甚至可以在设备上部署和运行.apk,但cordova run,我需要调试,失败:

ANDROID_HOME=C:\Users\16515\AppData\Local\Android\Sdk (recommended setting)
ANDROID_SDK_ROOT=C:\Users\16515\AppData\Local\Android\Sdk (DEPRECATED)
Using Android SDK: C:\Users\16515\AppData\Local\Android\Sdk
Command failed with exit code 1: avdmanager list avd
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:582)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        ... 5 more

它似乎需要Java-1.8,但“Android Gradle插件需要Java 11才能运行”.我可以使用Java-11实现这一点吗?

a64a0gku

a64a0gku1#

我的avdmanager来自Java 8,我需要更改路径以使用位于此处的路径:

> "C:\Users\\[me]\AppData\Local\Android\Sdk\cmdline-tools\<cmdline-tools_version>\bin"

相关问题