Android: Error when execute sdkmanager
Quick fix for error that sdkmanager throw exception when trying to call sdkmanager –license and sdkmanager –list.
Error messages
1 | Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema |
Quick fix
In Windows:
- Go to C:\Users\Alex.Li\AppData\Local\Android\Sdk\tools\bin
- Open sdkmanager.bat with editor
- Add -XX:+IgnoreUnrecognizedVMOptions –add-modules java.se.ee after set DEFAULT_JVM_OPTS=”-Dcom.android.sdklib.toolsdir=%~dp0..”:
1
set DEFAULT_JVM_OPTS="-Dcom.android.sdklib.toolsdir=%~dp0\.." -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee
In Linux:
- Go to
/tools/bin ,is the path where you unzip your Android SDK. - Open sdkmanger with editor
- Add -XX:+IgnoreUnrecognizedVMOptions –add-modules java.se.ee after DEFAULT_JVM_OPTS=’”-Dcom.android.sdklib.toolsdir=$APP_HOME”‘“:
1
DEFAULT_JVM_OPTS='"-Dcom.android.sdklib.toolsdir=$APP_HOME" -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'