Android dependency库版本冲突解决方案

阅读 73

2022-02-19

Unity打包安卓APK遇到问题:

Android dependency 'com.android.support:support-compat' has different version for the compile (27.0.2) and runtime (27.1.1) classpath. You should manually set the same version via DependencyResolution

解决方案一:

        在知道是哪个库文件引用存在冲突的可以在gradle中,在库引用的地方添加

api ('com.linecorp.linesdk:linesdk:5.4.0') {
        exclude group: 'com.android.support', module: 'support-compat'
    }

解决方案二:

        Grovvy脚本指定版本号。在gradle文件中添加代码

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support' && !details.requested.name.contains('multidex') ) {
                details.useVersion '27.0.2' // 指定想要的版本号
            }
        }
    }
}

精彩评论(0)

0 0 举报