gradle构建失败

项目场景:

gradle构建失败


问题描述

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:checkDebugAarMetadata’.

Could not resolve all files for configuration ‘:app:debugRuntimeClasspath’.
Failed to transform annotation-experimental-1.4.0.aar (androidx.annotation:annotation-experimental:1.4.0) to match attributes {artifactType=android-aar-metadata, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
Execution failed for JetifyTransform: C:\Users\cwt.gradle\wrapper\dists\gradle-6.5-bin\caches\modules-2\files-2.1\androidx.annotation\annotation-experimental\1.4.0\c7a2038d831d0cfbfb9a440890b287c2e839ecf\annotation-experimental-1.4.0.aar.
Failed to transform ‘C:\Users\cwt.gradle\wrapper\dists\gradle-6.5-bin\caches\modules-2\files-2.1\androidx.annotation\annotation-experimental\1.4.0\c7a2038d831d0cfbfb9a440890b287c2e839ecf\annotation-experimental-1.4.0.aar’ using Jetifier. Reason: IllegalArgumentException, message: Unsupported class file major version 61. (Run with --stacktrace for more details.)
Suggestions:
- Check out existing issues at https://issuetracker.google.com/issues?q=componentid:460323&s=modified_time:desc, it’s possible that this issue has already been filed there.
- If this issue has not been filed, please report it at https://issuetracker.google.com/issues/new?component=460323 (run with --stacktrace and provide a stack trace if possible).


原因分析:

创建空项目时,默认AndroidX库版本('androidx.appcompat:appcompat:1.7.0‘mplementation ‘com.google.android.material:material:1.12.0’)和jdk(1.8)版本不匹配


解决方案:

降低androidx.appcompat:appcompat版本(1.2.0)implementation 'com.google.android.material:material版本:(1.2.1)
dependencies {
implementation ‘com.google.android.material:material:1.2.1’
//implementation ‘com.google.android.material:material:1.12.0’
implementation ‘androidx.appcompat:appcompat:1.2.0’
//implementation ‘androidx.appcompat:appcompat:1.7.0’

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值