Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.8.0-runtime

首先看下报错信息吧~

Duplicate class android.support.v4.app.INotificationSideChannel found in modules 

core-1.8.0-runtime (androidx.core:core:1.8.0) and 

support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)

看了报错信息明白了,这是类冲突了,INotificationSideChannel这个类在androidx.core:core:1.8.0与com.android.support:support-compat:26.1.0这个两个模块中都有。我androidx的项目还引入了support库???还是回顾下冲突的产生吧。貌似我就创建个hello word项目简单引入一个google库:

在这里插入图片描述
项目中引入了support库? 来瞅瞅:
在这里插入图片描述

还真的有 emmmm,,,,,测试下吧刚添加的依赖移除后这个support库就没了。

如何解决这个问题呢?很简单,gradle.properties 添加如下即可。

//表示当前项目启用 AndroidX,2022年了,大家的项目估计都androidx了,,,,
android.useAndroidX=true
//表示将依赖包也迁移到AndroidX,将项目中用到的第三方库中的support引用转为androidx引用
android.enableJetifier=true

猜你喜欢

转载自blog.csdn.net/qq_38350635/article/details/126253120