About the latest version of Android Studio compilation prompt Unable to load class 'javax.xml.bind.JAXBException'.

About the latest version of Android Studio compilation prompt Unable to load class 'javax.xml.bind.JAXBException'.

After upgrading the new version of AS, he will force you to use jdk11, otherwise you will be prompted like this


An exception occurred applying plugin request [id: 'com.android.application']
> Failed to apply plugin 'com.android.internal.application'.
   > Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
     You can try some of the following options:
       - changing the IDE settings.
       - changing the JAVA_HOME environment variable.
       - changing `org.gradle.java.home` in `gradle.properties`.
————————————————
版权声明:本文为CSDN博主「zhanqq2012」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/zhanqq2012/article/details/77430342

Then you upgrade jdk to 11 and compile and you will be prompted

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

Then Baidu, almost all the first few pages of Baidu ask you to reduce the JDK version to 8. Who wrote this blog, I am afraid it is not cerebral palsy.
In fact, your gradle version and gradle plug-in version are too low, and it will be ok after upgrading. The following two versions are recommended, and it is not necessary to use this version

classpath 'com.android.tools.build:gradle:4.2.0'
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip

Just recompile and it's OK!!!

Guess you like

Origin blog.csdn.net/fzkf9225/article/details/126050087