Firebase 11.0.2库的Google Play Service版本冲突

时间:2017-07-03 09:13:47

标签: android firebase gradle google-play-services

我将Firebase库更新到最新版本,但我无法同步gradle,这会导致以下错误:

  

错误:任务执行失败   ':应用程序:processProductionDebugGoogleServices'

     
    

请通过更新google-services插件的版本来修复版本冲突(有关最新版本的信息是     可在     https://bintray.com/android/android-tools/com.google.gms.google-services/)     或将com.google.android.gms的版本更新为11.0.2。

  

正如它所述,我也将gms版本更新为11.0.2。这是我的傻瓜:

compileSdkVersion 25
buildToolsVersion "26.0.0"

//other gradle config

String googleSupportVersion = '25.3.1'
String googlePlayServicesVersion = '11.0.2'

compile "com.google.firebase:firebase-core:$googlePlayServicesVersion"
compile "com.google.firebase:firebase-auth:$googlePlayServicesVersion"
compile "com.android.support:appcompat-v7:$googleSupportVersion"
compile "com.android.support:support-v4:$googleSupportVersion"
compile "com.google.android.gms:play-services:$googlePlayServicesVersion"
compile "com.android.support:design:$googleSupportVersion"
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
apply plugin: 'com.google.gms.google-services'

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.2'
        classpath 'com.google.gms:google-services:3.1.0'
    }
}

如何解决此问题?

2 个答案:

答案 0 :(得分:4)

将您的Google服务插件更新为3.1.0

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.1.0'
    }
}

答案 1 :(得分:0)

试试这个def googlePlayServicesVersion = '11.0.2'代替String googlePlayServicesVersion = '11.0.2'