Failed to Run Sdkmanager --List with Java 9

Android SDK manager throw Exception with Java 9

Edit sdkmanager file, find DEFAULT_JVM_OPTS and add --add-modules java.xml.bind argument to it.

For instance, if your sdkmanager file has

DEFAULT_JVM_OPTS='"-Dcom.android.sdklib.toolsdir=$APP_HOME"'

change it to

DEFAULT_JVM_OPTS='"-Dcom.android.sdklib.toolsdir=$APP_HOME" --add-modules java.xml.bind'

Update: the above works for Java 9 and 10. The java.xml.bind module was removed in Java 11, and will not be found.

https://www.oracle.com/java/technologies/javase/jdk-11-relnote.html#JDK-8190378


Additional Update: Apparently there are two versions of the sdkmanager, a deprecated one that requires Java8 and a new one that works with Java 11. See this answer on StackOverflow

Failed to install android-sdk: java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema

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

Fix sdkmanager java.lang.NoClassDefFoundError batchfile

You can try this solution

First open sdkmanager.bat with any text editor

Then find this line

  %JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %SDKMANAGER_OPTS%

And change it to this line

  %JAVA_EXE%" %DEFAULT_JVM_OPTS% --add-modules java.xml.bind %JAVA_OPTS% %SDKMANAGER_OPTS%

I hope this solves your problem.

Failed to install the following Android SDK packages as some licences have not been accepted error

You need to accept the licences before building.

According to Android SDK docs you can use the following command depending on the sdkmanager location: Docs on --licenses option seems to be missing though.

yes | sdkmanager --licenses

GNU/Linux Distributions:

yes | ~/Android/Sdk/tools/bin/sdkmanager --licenses

macOS:

export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home
yes | ~/Library/Android/sdk/tools/bin/sdkmanager --licenses

Windows:

%ANDROID_HOME%/tools/bin/sdkmanager --licenses

Flutter:

> flutter config --android-sdk 'path-of-android-sdk'(only for ubuntu user)
> flutter doctor --android-licenses

Android sdkmanager does not list installed packages?

I cannot believe it, I found the answer right here. Thank you so much Jing Li!

So basically what you have to do is put the "tools" folder that you get after unzipping inside a folder named "cmdline-tools" (how on earth would you know... !?). And then later the path to that "cmdline-tools" folder is your "--sdk_root" parameter. Keep in mind that I'm using "--sdk_root" due to a bug at the time (april 2020), hopefully soon all of this is not needed anymore. My installed packages are listed now.



Related Topics



Leave a reply



Submit