【问题标题】:Error when I tried to add dependency to build.gradle当我尝试将依赖项添加到 build.gradle 时出错
【发布时间】:2016-11-29 12:40:16
【问题描述】:

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

我想在我的应用程序中使用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'

如何解决我的错误?

【问题讨论】:

  • 从顶部删除apply plugin: 'com.google.gms.google-services'。您可以使用10.0.0版本
  • 然后clean-rebuild 运行。希望对你有帮助

标签: android android-gradle-plugin


【解决方案1】:
compile 'com.google.android.gms:play-services-auth:9.2.0'

play-services-auth依赖改成上面的代码sn-p,去掉顶部的插件,即

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

【讨论】:

  • 对于黄油刀,使用 compile 'com.jakewharton:butterknife:7.0.1'
猜你喜欢
  • 2018-01-16
  • 2020-07-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-03-28
  • 1970-01-01
  • 2023-02-12
  • 2022-11-24
相关资源
最近更新 更多