A Web Developer trying to create android app using Ubuntu 18.04 with Cordova (v.8.0.0) requirements show:

    Android Studio project detected
    Requirements check results for android:
    Java JDK: installed 
    Android SDK: installed true
    Android target: not installed 
    avdmanager: Command failed with exit code 1 Error output:
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml    /bind/annotation/XmlSchema
    at com.android.repository.api.SchemaModule$SchemaModuleVersion.(SchemaModule.java:156)
    at com.android.repository.api.SchemaModule.(SchemaModule.java:75)
    at com.android.sdklib.repository.AndroidSdkHandler.(AndroidSdkHandler.java:81)
    at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:213)
    at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200)
    Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)... 5 more
    Gradle: installed /usr/lib/gradle/4.8.1/bin/gradle

I used Android Studio to create the AVDs:

emulator -list-avds

I have tried:

$ANDROID_HOME/tools/bin/avdmanager create avd --force --name testAVD --abi google_apis/x86_64 --package 'system-images;android-25;google_apis;x86_64'

But I get the same error:

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

I've tried different versions of Java/SDK and Gradle, Ionic and so on. There is a step missing in every instructions and all debug do not clearly explain the step of Android target: not installed.


You can try by adding this environment variable

export JAVA_OPTS="--add-modules java.xml.bind"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.