方法1.依赖移除
直接移除第三方框架里面的其他冲突依赖 如下
dependencies {
api(Dependencies.arouter){
this.exclude(group = "android.activity", module = "activity")
}
}
方法2:版本统一
如下图多个版本的依赖
我们可以project下面的build文件添加相关配置
allprojects {
configurations.all {
this.resolutionStrategy.eachDependency {
println(this.requested.group+"==="+this.requested.name+"==="+this.requested.version)
if (this.requested.group=="androidx.activity"){
if (this.requested.name.startsWith("activity")) {
this.useVersion("1.4.0")
}
}
}
}
然后build后就只有一个版本的