'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?
Solution 1:[1]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | ??? |