简体   繁体   中英

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

I am on MacOS, installed the JDKs 8 ( LTS ) from AdoptOpenJDK to get the android environment up and running and that worked fine!

brew cask install adoptopenjdk/openjdk/adoptopenjdk8

But Getting the following error while running sdkmanager or avdmanager due to the fact the Gradle 6.5.1 now requires JVM 14.0.1 (Oracle Corporation 14.0.1+14).

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

As it is suggested here https://stackoverflow.com/a/51644855/6716408 the fix is downgrading the java version but that is not possible because gradle's java dependency.

Any solutions?

the cmdline-tools package from Google contains a replacement version of avdmanager that runs fine under Java 9 and upwards. The cmdline-tools should be installed in ~/Android/Sdk/cmdline-tools/latest. Use the avdmanager from that path instead.

update.zshrc/.bash_profile,like beblow

 # android sdk export ANDROID_HOME=$HOME/Library/Android/sdk export PATH=$PATH:$ANDROID_HOME/emulator export PATH=$PATH:$ANDROID_HOME/tools # export PATH=$PATH:$ANDROID_HOME/tools/bin // remove this line export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin // add this line export PATH=$PATH:$ANDROID_HOME/platform-tools

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM