Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema EXCEPTION

Viewed 3682

Hi Guys i have problem with install sdkmanager "system-images;android-27;google_apis_playstore;x86"

when i enter this code, then it sends me an exception:

enter image description here

i read i must install java sdk 8 so i installed after i must indicate path so i do it and again i have this EXception

i will add i checked flutter doctor and this my result: enter image description here

link to articles that I supported: No Suitable Android AVD Available

Version java:

enter image description here

paths that had to be entered in the supported article:

enter image description here

Path:enter image description here

1 Answers

Carefully check the Android SDK directory, there are two versions of sdkmanager.bat if you have installed a recent version of Android SDK. For older versions make sure the package Android SDK Command-line Tools (latest) is installed.

The first in tools\bin the other in cmdline-tools\latest\bin - the one will work, other not.

The recent version you should use

The version located in cmdline-tools\latest\bin is the one you should use. It is compatible with Java 9+ and will not cause the problems you have encountered.

The outdated version you should not use

The version in tools\bin is outdated and is incompatible with Java 9+. If you execute it with a Java Runtime greater than 8 you will get the following err or:

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:581)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        ... 5 more

Until Google finally removes this version of sdkmanager I would recommend to make sure the tools\bin folder is not in your PATH environment. Alternatively you can simply rename tools\bin\sdkmanager.bat so that it is no longer executed when you execute sdkmanager.

The whole story about why this is not yet fixed can be found in Google issue 67495440.

Related