./gradlew -q dependencies xrz_android:dependencies --configuration implementation
./gradlew -q dependencies base:dependencies --configuration implementation
app目录 build.gradle
configurations.all {
//循环一个个的依赖库
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
//获取当前循环到的依赖库
def requested = details.requested
//如果这个依赖库群组的名字是com.android.support
if (requested.group == 'com.android.support') {
//且其名字不是以multidex开头的
if (!requested.name.startsWith("multidex")) {
//这里指定需要统一的依赖版本
details.useVersion '28.0.0'
}
}
}
}
根目录 build.gradle
subprojects {
project.evaluationDependsOn(':app')
project.configurations.all {
resolutionStrategy.eachDependency { details ->
// if (details.requested.group == 'androidx.core' &&
// !details.requested.name.contains('androidx')) {
// details.useVersion "1.0.1"
// }
// def requested = details.requested
// if(requested.group == 'androidx.core'){
// details.useVersion "1.1.0"
// }
// if (requested.group == 'androidx.appcompat') {
// details.useVersion "1.1.0"
// }
// if (requested.group == 'androidx.fragment') {
// details.useVersion "1.0.0"
// }
// if (requested.group == 'androidx.recyclerview') {
// details.useVersion "1.1.0"
// }
def requested = details.requested
if (requested.group == 'androidx.activity') {
details.useVersion "1.2.4"
}
}
}
}
网友评论