Android SDK manager throw Exception with Java 9 [duplicate] Android SDK manager throw Exception with Java 9 [duplicate] android android

Android SDK manager throw Exception with Java 9 [duplicate]


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