Gradle:android支持版本冲突

时间:2017-09-27 12:58:05

标签: android gradle android-8.0-oreo

我在编译android sdk 26时遇到以下冲突

AAPT: Attribute "iconTint" already defined with incompatible format.

因此,我将支持版本设置为26.0.2,并尝试强制所有依赖项忽略其支持版本,具体如下:     exclude group: 'com.android.support'

但是,com.google.android.gms:play-services-basement依赖项仍然引用其自己的支持依赖项,即使我将其排除在外:

compile "com.android.support:support-v4:"
compile ("com.google.android.gms:play-services-basement:11.4.0"){
    exclude group: 'com.android.support'
}

./gradlew app:dependencies

|    +--- com.android.support:support-v4:26.0.2 (*)
|    +--- com.google.android.gms:play-services-basement:11.4.0
|    |    \--- com.android.support:support-v4:25.2.0 -> 26.0.2 (*)

任何想法为什么我的所有依赖项都通过应用上述规则排除了他们的支持,以及为什么play-services-basement不支持?感谢

1 个答案:

答案 0 :(得分:0)

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
    def requested = details.requested
    if (requested.group == 'com.android.support') {
        if (!requested.name.startsWith("multidex")) {
            if (!requested.name.startsWith("test")) {
                details.useVersion '26.1.0'
            }
        }
    }
}
}