用了旧版的 support 库,但是你的项目配置中使用了 AndroidX 库

项目设置了android.useAndroidX=true,但检测到配置中仍包含遗留支持库,这可能导致运行时问题。为避免在AndroidGradleplugin8.0及更高版本中出现此行为,需在gradle.properties文件中添加android.enableJetifier=true以迁移至AndroidX。报错详细列出了依赖链中的遗留库,如support-annotations、exifinterface和support-v4等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

报错:

Your project has set android.useAndroidX=true, but configuration :app:debugRuntimeClasspath still contains legacy support libraries, which may cause runtime issues.
This behavior will not be allowed in Android Gradle plugin 8.0.
Please use only AndroidX dependencies or set android.enableJetifier=true in the gradle.properties file to migrate your project to AndroidX (see https://developer.android.com/jetpack/androidx/migrate for more info).
The following legacy support libraries are detected:
:app:debugRuntimeClasspath -> com.squareup.picasso:picasso:2.71828 -> com.android.support:support-annotations:27.1.0
:app:debugRuntimeClasspath -> com.squareup.picasso:picasso:2.71828 -> com.android.support:exifinterface:27.1.0
:app:debugRuntimeClasspath -> com.journeyapps:zxing-android-embedded:3.6.0 -> com.android.support:support-v4:25.3.1
:app:debugRuntimeClasspath -> com.journeyapps:zxing-android-embedded:3.6.0 -> com.android.support:support-v4:25.3.1 -> com.android.support:support-compat:25.3.1
:app:debugRuntimeClasspath -> com.journeyapps:zxing-android-embedded:3.6.0 -> com.android.support:support-v4:25.3.1 -> com.android.support:support-media-compat:25.3.1
:app:debugRuntimeClasspath -> com.journeyapps:zxing-android-embedded:3.6.0 -> com.android.support:support-v4:25.3.1 -> com.android.support:support-core-utils:25.3.1
:app:debugRuntimeClasspath -> com.journeyapps:zxing-android-embedded:3.6.0 -> com.android.support:support-v4:25.3.1 -> com.android.support:support-core-ui:25.3.1
:app:debugRuntimeClasspath -> com.journeyapps:zxing-android-embedded:3.6.0 -> com.android.support:support-v4:25.3.1 -> com.android.support:support-fragment:25.3.1

问题分析:从 Android Gradle plugin 8.0 开始,将不再允许这种行为。

解决方法:项目文件gradle.properies中添加

android.enableJetifier=true

以便将项目迁移到 AndroidX

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

streetrust

花了时间整理资料,谢谢继续努力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值