美文网首页
解决"引用第三方依赖androidx冲突: Could not

解决"引用第三方依赖androidx冲突: Could not

作者: Wang_Mr | 来源:发表于2022-05-27 11:58 被阅读0次
引用 "api 'com.github.Baseflow:PhotoView:2.3.0'" 报异常如下
androidx包冲突.png

由于项目里用的是androidx.1.2.0,第三方PhotoView使用的是androidx.1.0.0。导致打包冲突

如何解决呢?

使用configurations.all来统一指定版本

build.gradle下:

allprojects {
    repositories {
        // ...
    }
    configurations.all {
        resolutionStrategy {
            resolutionStrategy.eachDependency { details ->
                if (details.requested.group == 'androidx.appcompat') {
                    // 指定统一版本
                    details.useVersion "1.2.0"
                }
                // ...可继续指定其它依赖版本
                // if(...){...}
            }
        }
    }
}

相关文章

网友评论

      本文标题:解决"引用第三方依赖androidx冲突: Could not

      本文链接:https://www.haomeiwen.com/subject/wipmprtx.html