android-studioandroid-sdk-manager

Running android sdkmanager results in java.lang.ClassNotFoundException


I just installed Android Studio on macOS. I need to accept the license. How do I run sdkmanager ?

$tools/bin/sdkmanager 
APP_HOME=/Users/steve/Library/Android/sdk/tools
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:583)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)

Note that I am running java11 in which javax.xml.bind is not present.


Solution

  • The interim workaround is that I reset the jdk version to java8. Then the sdkmanager was able to run. It remains to be seen if there were no other issues.