【问题标题】:Execution failed for task ':app:processDebugGoogleServices'任务“:app:processDebugGoogleServices”执行失败
【发布时间】:2018-04-02 21:06:11
【问题描述】:

我的 build.gradle(app) 为:

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
    applicationId "com.example.dpka.myproject"
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:support-v4:27.1.0'
implementation 'com.google.firebase:firebase-database:12.0.1'
implementation 'com.google.firebase:firebase-auth:12.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'com.google.firebase:firebase-core:12.0.1'
compile 'com.google.android.gms:play-services:12.0.1'
compile 'com.android.support:design:27.1.0'
compile 'com.android.support:cardview-v7:27.1.0'
compile 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.firebaseui:firebase-ui-database:3.3.0'

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

和 build.gradle(project) 为:

buildscript {

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

allprojects {
repositories {
    google()
    jcenter()
}
}

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

我得到了错误:

Error:FAILURE: Build failed with an exception.

* What went wrong:
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 12.0.1.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

我把com.google.android.gms的版本改成了12.0.1(如上代码所示),但还是提示这个错误,我该怎么办?

【问题讨论】:

  • 对了,firebase-auth:12.0.0需要使用12.0.1
  • 哦,我的错!谢谢! :) 我进行了更改,但现在执行 'com.android.support:appcompat-v7:27.1.0' 说要使用完全相同的版本规范。
  • edit 您的问题包括新的 Gradle 文件和构建输出。另外,我建议您删除 play-services:12.0.1' 并仅编译您实际计划使用的 Google 服务。例如,只有地图。在此处查看第二个蓝色框developers.google.com/android/guides/setup
  • @cricket_007 嘿!不幸的是,我无法发布问题,但我想问一个问题,我想检查日期(我有一个变量)是否是星期天,我该怎么做?请指导..

标签: java android firebase android-gradle-plugin build.gradle


【解决方案1】:

更改以下内容:

implementation 'com.google.firebase:firebase-auth:12.0.0'

到这里:

implementation 'com.google.firebase:firebase-auth:12.0.1'

所有 firebase 依赖项都必须是相同的版本。

【讨论】:

    猜你喜欢
    • 2016-02-07
    • 2018-05-28
    • 1970-01-01
    • 2019-06-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多