安卓11报错:Duplicate class android.support.v4.app..... found in modules core-1.13.0-runtime

本篇文章主要讲解,安卓11项目运行后报错Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.13.0-runtime的主要原因及解决办法。
作者: 任聪聪
独立博客:https://rccblogs.com/630.html
日期:2024年8月28日

详细报文信息:

Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.13.0-runtime (androidx.core:core:1.13.0) and support-compat-27.1.1-runtime (com.android.support:support-compat:27.1.1)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules core-1.13.0-runtime (androidx.core:core:1.13.0) and support-compat-27.1.1-runtime (com.android.support:support-compat:27.1.1)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules core-1.13.0-runtime (androidx.core:core:1.13.0) and support-compat-27.1.1-runtime (com.android.support:support-compat:27.1.1)
Duplicate class android.support.v4.os.IResultReceiver found in modules core-1.13.0-runtime (androidx.core:core:1.13.0) and support-compat-27.1.1-runtime (com.android.support:support-compat:27.1.1)
Duplicate class android.support.v4.os.IResultReceiver$Stub found in modules core-1.13.0-runtime (androidx.core:core:1.13.0) and support-compat-27.1.1-runtime (com.android.support:support-compat:27.1.1)
Duplicate class android.support.v4.os.IResultReceiver$Stub$Proxy found in modules core-1.13.0-runtime (androidx.core:core:1.13.0) and support-compat-27.1.1-runtime (com.android.support:support-compat:27.1.1)
Duplicate class android.support.v4.os.ResultReceiver found in modules core-1.13.0-runtime (androidx.core:core:1.13.0) and support-compat-27.1.1-runtime (com.android.support:support-compat:27.1.1)
Duplicate class android.support.v4.os.ResultReceiver$1 found in modules core-1.13.0-runtime (androidx.core:core:1.13.0) and support-compat-27.1.1-runtime (com.android.support:support-compat:27.1.1)
Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules core-1.13.0-runtime (androidx.core:core:1.13.0) and support-compat-27.1.1-runtime (com.android.support:support-compat:27.1.1)
Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules core-1.13.0-runtime (androidx.core:core:1.13.0) and support-compat-27.1.1-runtime (com.android.support:supp

主要原因说明:

这是由于已经导入的依赖中有涵盖相同core版本的情况,最终导致冲突报错,解决这个办法也很简单,找到那个冲突的依赖删掉或者换成其他依赖,但这种方法不建议,使用下面的解决办法可以不需要进行删除冲突依赖同样解决问题。

解决办法:

在文件 gradle.properties (根目录下的) 写入内容:

android.useAndroidX=true
android.enableJetifier=true

即可解决这个报错。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

任聪聪

创作不易,你的打赏是我的动力!

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

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

打赏作者

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

抵扣说明:

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

余额充值