直接在安卓项目的根目录下的build.gradle添加代码如下:
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency {
details ->
if (details.requested.group == 'androidx.core' &&
!details.requested.name.contains('androidx')) {
details.useVersion "1.5.1"
}
}
}
}
参考:
Android dependency ‘androidx.core:core’ has different version for the compile
Android dependency ‘androidx.lifecycle:lifecycle-runtime’ has different version for the compile