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?
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!...>