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, 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
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 cask install android-sdk
- 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