Andord:升级Android studio4.2编译失败问题

Posted wzj_what_why_how

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Andord:升级Android studio4.2编译失败问题相关的知识,希望对你有一定的参考价值。

e: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException

Execution failed for task ‘:app:kaptNormalDebugKotlin’.
Internal compiler error. See log for more details

在项目中的build.gradle中

 //dependencies闭包
    dependencies {
    	//原先是3.5.3
        classpath 'com.android.tools.build:gradle:4.0.0'
		//...
    }

调整完,同步一下,之后会出现这样的提示:

这里是引用Minimum supported Gradle version is 6.1.1. Current version is 5.4.1.

Please fix the project’s Gradle settings. Change Gradle version in
Gradle wrapper to 6.1.1 and re-import project Open Gradle wrapper
properties Gradle Settings.

点击确定修改即可。

Gradle sync failed: Minimum supported Gradle version is 6.1.1. Current version is 5.4.1.
Please fix the project’s Gradle settings.
Change Gradle version in Gradle wrapper to 6.1.1 and re-import project
Open Gradle wrapper properties
Gradle Settings. (7 s 339 ms)

在gradle-wrapper.properties中修改配置:

distributionBase=GRADLE_USER_HOME
distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
//zipStorePath=wrapper/dists
//distributionUrl=https://services.gradle.org/distributions/gradle-5.4.1-all.zip

换掉注释的这两行,更新。

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

以上是关于Andord:升级Android studio4.2编译失败问题的主要内容,如果未能解决你的问题,请参考以下文章

Android studio4.0.1对应的gradle是哪个版本?

Android Studio4.2.2 如何新建项目

Ubuntu下使用Android Studio4.0与 ndk-bundle 进行ndk开发总结

Lint 基础结构错误原因:java.lang.reflect.InvocationTargetException - Android Studio 4.2.2

更新到 Android Studio 4.1 时出现 java.lang.AssertionError

Android Studio 4.1更新后应用程序的Gradle构建错误