英文:
Using andoird "sdkmanager" with OpenJDK 11
问题
I want to use Android sdkmanager
with OpenJDK instead of Oracle JDK and I've installed the package default-jre
in ubuntu 18.04. But when I run sdkamanger
I get the following errors:
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.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 5 more
There's a similar question here and it has been suggested to add the option -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee
to the variable DEFAULT_JVM_OPTS
in the file sdkmanager
. But since I want to use OpenJDK I don't have the module java.se.ee
.
I have almost no experience in Java and I just want to install Android NDK to use with Qt and C++, not java or kotlin.
Any idea?
英文:
I want to use Android sdkmanager
with OpenJDK instead of Oracle JDK and I've installed the package default-jre
in ubuntu 18.04.But when I run sdkamanger
I get the following errors:
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.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 5 more
There's a similar question here and it has been suggested to add the option -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee
to the variable DEFAULT_JVM_OPTS
in the file sdkmanager
.But since I want to use OpenJDK I don't have the module java.se.ee
.
I have almost no experience in Java and I just want to install Android NDK to use with Qt and C++,not java or kotlin.
Any idea?
答案1
得分: 1
以下是翻译好的部分:
所以我面对了同样的错误。
但是这个答案解决了我的问题。
下载所有在“Android/tools/bin”中提到的文件。然后编辑sdkmanager
和avdmanager
脚本。
添加以下行,不要删除其他Jars:
CLASSPATH=$APP_HOME/bin/jaxb_lib/activation.jar:$APP_HOME/bin/jaxb_lib/jaxb-impl.jar:$APP_HOME/bin/jaxb_lib/jaxb-xjc.jar:$APP_HOME/bin/jaxb_lib/jaxb-core.jar:$APP_HOME/bin/jaxb_lib/jaxb-jxc.jar:$APP_HOME/bin/jaxb_lib/jaxb-api.jar:<等等等等...不要删除其他Jars!...>
英文:
So I faced this same error.
But this answer resolved my issue.
Download all the mentioned files in "Android/tools/bin". Then Edit both sdkmanager and avdmanager scripts
.
Add the following lines and do not remove the other Jars:
CLASSPATH=$APP_HOME/bin/jaxb_lib/activation.jar:$APP_HOME/bin/jaxb_lib/jaxb-impl.jar:$APP_HOME/bin/jaxb_lib/jaxb-xjc.jar:$APP_HOME/bin/jaxb_lib/jaxb-core.jar:$APP_HOME/bin/jaxb_lib/jaxb-jxc.jar:$APP_HOME/bin/jaxb_lib/jaxb-api.jar:<etc etc...DO NOT REMOVE THE OTHER JARS!...>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论