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

22,782

Solution 1

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

Solution 2

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.

Solution 3

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

Solution 4

I had the same problem and I solved it by updating "DSL element 'android.dataBinding.enabled' is obsolete and has been replaced with 'android.buildFeatures.dataBinding'"

android {

    buildFeatures {

         dataBinding true

         // for view binding:
         // viewBinding true
    }
}

Reference DSL element 'android.dataBinding.enabled' is obsolete and has been replaced with 'android.buildFeatures.dataBinding'

Solution 5

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.

Share:
22,782
Didier Supernover
Author by

Didier Supernover

I am Developer that thrives in a fast paced environment and I am currently looking for an opportunity to apply my technical experience and my creative

Updated on July 09, 2022

Comments

  • Didier Supernover
    Didier Supernover almost 2 years

    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**

    please let me know if you have answer for m

  • Daniel Sanchez
    Daniel Sanchez almost 3 years
    Hi Smith, how can I do that?
  • Matrix
    Matrix almost 3 years
    I just change to classpath 'com.android.tools.build:gradle:4.0.0' for as4.2 , it works thanks.
  • Tharkius
    Tharkius almost 3 years
    You are the real life-saver! THIS should be the accepted answer since updating gradle and AGP isn't always the way to go for some projects...
  • CausingUnderflowsEverywhere
    CausingUnderflowsEverywhere almost 3 years
    Another solution by @Dheeraj Sharma was changing the classpath gradle to 4.2.2 and the distribution url version to gradle-6.7.1-all.zip.