We Are Going To Discuss About Failed to install android-sdk: “java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema”. So lets Start this Java Article.
Failed to install android-sdk: “java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema”
- Failed to install android-sdk: “java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema”
Just had this error, solved by downloading the
Android SDK Command-line Tools (latest)
on Android Studio, underPreferences > Appearance & Behavior > System Settings > Android SDK > SDK Tools
and re-runningflutter doctor --android-licenses
- Failed to install android-sdk: “java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema”
Just had this error, solved by downloading the
Android SDK Command-line Tools (latest)
on Android Studio, underPreferences > Appearance & Behavior > System Settings > Android SDK > SDK Tools
and re-runningflutter doctor --android-licenses
Solution 1
Just had this error, solved by downloading the Android SDK Command-line Tools (latest)
on Android Studio, under Preferences > Appearance & Behavior > System Settings > Android SDK > SDK Tools
and re-running flutter doctor --android-licenses
Finally, add the new tools to your PATH, in your .bashrc
, .zshrc
or similar, before the obsolete tools:
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin
Original Author EdYuTo Of This Content
Solution 2
I had a similar problem this morning (trying to build for Android using Unity3D). I ended up uninstalling JDK9 and installing Java SE Development Kit 8u144. Hope this helps.
brew cask uninstall java
# uninstall java9brew tap homebrew/cask-versions
brew cask install java8
# install java8touch ~/.android/repositories.cfg
# without this file, error will occur on next stepbrew install --cask android-sdk
Original Author spassvogel Of This Content
Solution 3
- I also had this error
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:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
... 5 more
- then instead of uninstalling the latest java environment, (in my case it is java 13)
- and installation of
java 8
, - I have done the following steps
open the android studio > go to configure > select sdk manager > go to sdk tools > make a tick on android sdk command line tools >apply > and wait for installation
-
enter the command
flutter doctor
-
enter the command
flutter doctor --android-licenses
-
and accept all the licenses by typing
y
Original Author Rohan Devaki Of This Content
Solution 4
To solve this error, you can downgrade your Java version.
Or exports the following option on your terminal:
Linux/MAC:
export JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'
Windows:
set JAVA_OPTS=-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee
If this does not work try to exports the java.xml.bind
instead.
Linux:
export JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.xml.bind'
Windows:
set JAVA_OPTS=-XX:+IgnoreUnrecognizedVMOptions --add-modules java.xml.bind
And to save it permanently you can exports the JAVA_OPTS
in your profile file on Linux (.zshrc
, .bashrc
and etc.) or add it as an environment variable permanently on Windows.
ps. This doesn’t work for Java 11/11+, which doesn’t have Java EE modules. For this option is a good idea, downgrade your Java version or wait for a Flutter update.
Original Author valdeci Of This Content
Conclusion
So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.