Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android check with NoClassDefFoundError: javax/xml/bind/JAXBException

I'm trying to run the ./gradlew clean check but I'm facing the following error:

> Task :app:kaptDebugKotlin FAILED
e: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
        at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3137)
        at java.base/java.lang.Class.getConstructor0(Class.java:3342)
        at java.base/java.lang.Class.newInstance(Class.java:556)
        at org.jetbrains.kotlin.cli.jvm.plugins.ServiceLoaderLite.loadImplementations(ServiceLoaderLite.kt:50)
        at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension$loadProcessors$efficientProcessorLoader$1.doLoadProcessors(Kapt3Extension.kt:83)
... more ...
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)

There's anything that could be missing on gradle configuration?

like image 607
Bruno Martins Avatar asked Aug 13 '19 04:08

Bruno Martins


3 Answers

I uninstall the Java 11 and install the java 8

like image 60
Bruno Martins Avatar answered Nov 07 '22 21:11

Bruno Martins


Update your gradle version in project level gradle

classpath 'com.android.tools.build:gradle:4.x.x'

OR

Change File->Project Structure->SDK Location->JDK path to jdk 1.8 location "Home" folder which should be installed in your system.

like image 7
Jenis Kasundra Avatar answered Nov 07 '22 20:11

Jenis Kasundra


If you are using Android Studio 3.6 or later go to Project Structure -> SDK Location and change JDK Location. Android Studio comes with default JRE. It is available in dropdown menu.

like image 4
user3094433 Avatar answered Nov 07 '22 21:11

user3094433