我尝试向build.gradle添加依赖项时出错

时间:2016-11-29 12:40:17

标签: android android-gradle

我没有找到答案。这是我的问题:

我想在我的应用中使用Google Sign-In。当我开始添加谷歌库时,我收到了这个错误:

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

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

这是我的gradle个文件:

热门级别:

    buildscript {
    repositories {
        jcenter()
        mavenLocal()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
        mavenLocal()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

应用级别:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.1"
    defaultConfig {
        minSdkVersion 18
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
    }    
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:25.0.1'
    compile 'com.jakewharton:butterknife:8.4.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
    compile 'com.google.android.gms:play-services-auth:10.0.1'
}

apply plugin: 'com.google.gms.google-services'

如何解决我的错误?

1 个答案:

答案 0 :(得分:1)

compile 'com.google.android.gms:play-services-auth:9.2.0'

play-services-auth依赖更改为上面的代码段,并删除顶部的插件,即

apply plugin: 'com.google.gms.google-services'