“Using Android ‘sdkmanager’ with OpenJDK 11”

huangapple go评论82阅读模式
英文:

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 &quot;main&quot; java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
        at com.android.repository.api.SchemaModule$SchemaModuleVersion.&lt;init&gt;(SchemaModule.java:156)
        at com.android.repository.api.SchemaModule.&lt;init&gt;(SchemaModule.java:75)
        at com.android.sdklib.repository.AndroidSdkHandler.&lt;clinit&gt;(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”中提到的文件。然后编辑sdkmanageravdmanager脚本。
添加以下行,不要删除其他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:&lt;etc etc...DO NOT REMOVE THE OTHER JARS!...&gt;

huangapple
  • 本文由 发表于 2020年7月28日 17:38:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/63131225.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定