引用第三方包重复处理
问题描述:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'androidx.media:media' has different version for the compile (1.0.0-rc01) and runtime (1.0.0) classpath. You should manually set the same version via DependencyResolution
处理:
1、gradlew app:dependencies > log_depend.txt
2、打开文件log_depend.txt
,查找引用了不同版本的包
在对应引用时添加:如
或者工程的build.gradle中统一修改,类似:
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('support-annotations')) {
details.useVersion '28.0.0'
}
}
}
}
3、gradle.properties中添加
android.enableJetifier=true
android.useAndroidX=true