This is an unexpected error. Please file a bug containing the idea.log file

Viewed 32903

Unable to load class 'javax.xml.bind.JAXBException'.

spent much time for this error but I don't get it , what's wrong with my code in android studio , when I run app

**Execution failed for task ':app:compileDebugJavaWithJavac'.

javax/xml/bind/JAXBException**

6 Answers

I too faced the same issue when I updated my Android Studio to V4.2. I had to modify two files.

In build.gradle, I changed dependency from

classpath 'com.android.tools.build:gradle:3.6.3'

to

classpath 'com.android.tools.build:gradle:4.0.0'

In gradle-wrapper.properties, I changed the distributionUrl from

distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

to

   distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

I had the same problem and I solved it by changing the Android JDK path by JDK 8.

First you need to download and install JDK 8 from this link [JDK 8] (https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html)

and should change your JDK path manually: Go to Project Structure -> SDK Location -> JDK Location -> select the three dots button -> select the JDK 8 folder installed in your pc (generally it will be in C:\Program Files\Java\jdk1.8.. ) press ok. it solved this problem for me.

I too faced this issue and this helped me to rectify. In build.grade, change the classpath to

classpath com.android.tools.build:gradle:4.0.0

In gradle-wrapper.properties, change the distributionUrl

distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

this is because your Android Studio was upgraded to 4.2, and in 4.2 the AS is build in java 11, you should change your JDK path manually, Project Structure -> SDK Location, don't use your Android Studio.app's JDK path. install or change another one.

I simply upgraded Gradle and it worked

Related