title: Failed to install android-sdk: "java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema"
body: <p>When installing the android sdk tools the following error is emitted:</p>
  
  <blockquote>
    <p>java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema</p>
  </blockquote>
  
  <p>Why is this happening and how can it be fixed?</p>
  
  <p>Debug output:</p>
  
  <pre><code>$ java --version
  java 9
  Java(TM) SE Runtime Environment (build 9+181)
  Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
  $ brew cask install android-sdk
  ==&gt; Caveats
  We will install android-sdk-tools, platform-tools, and build-tools for you.
  You can control android sdk packages via the sdkmanager command.
  You may want to add to your profile:
    'export ANDROID_SDK_ROOT=/usr/local/share/android-sdk'
  
  This operation may take up to 10 minutes depending on your internet connection.
  Please, be patient.
  
  ==&gt; Satisfying dependencies
  ==&gt; Downloading https://dl.google.com/android/repository/sdk-tools-darwin-3859397.zip
  Already downloaded: /Users/tomasnovella/Library/Caches/Homebrew/Cask/android-sdk--3859397,26.0.1.zip
  ==&gt; Verifying checksum for Cask android-sdk
  ==&gt; Installing Cask android-sdk
  ==&gt; Exception in thread "main"
  ==&gt; java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
  ==&gt;     at com.android.repository.api.SchemaModule$SchemaModuleVersion.&lt;init&gt;(SchemaModule.java:156)
  ==&gt;     at com.android.repository.api.SchemaModule.&lt;init&gt;(SchemaModule.java:75)
  ==&gt;     at com.android.sdklib.repository.AndroidSdkHandler.&lt;clinit&gt;(AndroidSdkHandler.java:81)
  ==&gt;     at com.android.sdklib.tool.SdkManagerCli.main(SdkManagerCli.java:117)
  ==&gt;     at com.android.sdklib.tool.SdkManagerCli.main(SdkManagerCli.java:93)
  ==&gt; Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
  ==&gt;     at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
  ==&gt;     at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
  ==&gt;     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
  ==&gt;     ... 5 more
  Error: Command failed to execute!
  
  ==&gt; Failed command:
  /usr/local/Caskroom/android-sdk/3859397,26.0.1/tools/bin/sdkmanager tools platform-tools build-tools;26.0.1
  
  ==&gt; Standard Output of failed command:
  
  
  ==&gt; Standard Error of failed command:
  Exception in thread "main" 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.SdkManagerCli.main(SdkManagerCli.java:117)
  </code></pre>