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" java java

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

Android SDK path on Android Studio

Command-line Tools

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.

  1. brew cask uninstall java # uninstall java9
  2. brew tap homebrew/cask-versions
  3. brew cask install java8 # install java8
  4. touch ~/.android/repositories.cfg # without this file, error will occur on next step
  5. brew 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 image description here

enter image description hereenter image description here

  • restart the command line toolenter image description here

  • enter the command flutter doctor

  • enter the command flutter doctor --android-licenses

  • and accept all the licenses by typing y

enter image description here