移除某個第三方的依賴
debugImplementation ('me.ele:uetool:1.0.15'){
exclude group: 'com.android.support', module: 'support-v7'
}
debugImplementation ('me.ele:uetool:1.0.15'){
exclude group: 'com.android.support'
}
有時候永丝,亂七八糟的依賴過多楣责,可以使用如下方案:
在 app的module中:
android{
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (requested.name.startsWith("appcompat-v7")) {
details.useVersion '25.3.0'
}
if (requested.name.startsWith("appcompat-v4")) {
details.useVersion '25.3.0'
}
if (requested.name.startsWith("recyclerview-v7")) {
details.useVersion '25.3.0'
}
}
}
}
}
這樣可以強制使用某個版本盟萨,不用再一個個去過濾了啼县。