关于最新版Android Studio编译提示Unable to load class ‘javax.xml.bind.JAXBException’.的问题
升级新版AS后,他会强制你使用jdk11,不然就会这样提示你
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`.
然后你把jdk升级为11后编译又会提示你
Unable to load class 'javax.xml.bind.JAXBException'.
然后百度一下,百度的前几页几乎全是让你降低JDK版本为8,这谁写的博客,怕不是脑瘫吧。
其实是你的gradle版本和gradle插件版本过低了,升级一下就ok了,下面推荐两个版本,并不是一定要使用此版本
classpath 'com.android.tools.build:gradle:4.2.0'
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
重新编译下就OK!!!