解决这个问题的方法是在 app/app_resources/android 文件夹中的 app.gradle 文件中添加一个部分。
您的默认设置可能如下所示:
// Add your native dependencies here:
// Uncomment to add recyclerview-v7 dependency
//dependencies {
// compile 'com.android.support:recyclerview-v7:+'
//}
android {
defaultConfig {
generatedDensities = []
applicationId = "__PACKAGE__"
//override supported platforms
// ndk {
// abiFilters.clear()
// abiFilters "armeabi-v7a"
// }
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
将其更改为如下所示:
dependencies {
configurations.all {
exclude group: 'commons-logging', module: 'commons-logging'
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.google.android.gms' || requested.group == 'com.google.firebase') {
details.useVersion '15.0.1'
} else if (requested.group == 'com.android.support' && requested.name != 'multidex') {
// com.android.support major version should match buildToolsVersion
details.useVersion '27.+'
}
}
}
}
project.ext {
googlePlayServicesVersion = "15.0.1"
supportVersion = "27.+"
}
android {
defaultConfig {
generatedDensities = []
applicationId = "__PACKAGE__"
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
project.ext {
googlePlayServicesVersion = "15.0.1"
supportVersion = "27.+"
}
}
这应该强制 Gradle 使用 15.0.1 来用于两个插件...