Google 身份验证版本与 Google 地图冲突

Google authentication version conflict with Google Maps

我在关注 the official Google authentication process。我的应用已经在使用最新版本的 Google 地图。

项目

dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath 'com.google.gms:google-services:3.1.2'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

应用程序

apply plugin: 'com.google.gms.google-services'
....
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.google.android.gms:play-services-auth:11.8.0'

地图下有一条红线,弹出窗口说它找到了 11.8.0 和 11.4.2。构建错误消息类似于

Error:Execution failed for task ':app:processDebugGoogleServices'.

Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 11.4.2.

如果我注释掉apply plugin: 'com.google.gms.google-services',构建错误就消失了,但是官方文档让我添加它。

我该如何解决这个问题?

在项目级build.gradle的依赖中添加如下行:

classpath 'com.google.gms:google-services:3.0.0'

有关完整的工作示例,请查看 github 上的 following project

勾选':app:processDebugGoogleServices' , Android Studio Gradle: Error:Execution failed for task ':app:processDebugGoogleServices'.

希望对您有所帮助。