我正在追踪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。生成错误消息是这样的,


  错误:任务':app:processDebugGoogleServices'的执行失败。
  
  请通过更新google-services插件的版本(https://bintray.com/android/android-tools/com.google.gms.google-services/上提供有关最新版本的信息)或将com.google.android.gms的版本更新为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'.

希望这对您有帮助。

07-28 03:17
查看更多