执行失败 app:processDebugGoogleServices'

Execution failed with app:processDebugGoogleServices'

我一直在尝试添加从 Firebase firestore 检索我的一些图像。添加依赖项后出现以下错误

"Error: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 10.0.1."

这是我的模块应用 gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.1"
    defaultConfig {
        applicationId "com.example.rimapps.charpapers"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions{
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'

    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:27.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:27.+'
    compile 'com.android.support:recyclerview-v7:27.+'
    compile 'com.android.support:cardview-v7:27.+'
    compile 'com.google.firebase:firebase-messaging:10.0.1'
    testCompile 'junit:junit:4.12'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.google.firebase:firebase-firestore:11.4.2'
    compile 'com.google.firebase:firebase-appindexing:10.0.1'

}
apply plugin: 'com.google.gms.google-services'
这是我的项目gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0'
        //classpath 'com.google.gms:google-services:3.1.0'
        // 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.1'
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://maven.google.com" }

    }
}

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

请帮助解决这个问题,我已经尽力了。

读取错误日志

"Error:Execution failed for task ':app:processDebugGoogleServices'. > Please fix the version conflict either by updating the version of the google-services plugin

您应该使用 SAME 版本 (版本冲突) 。使用 11.4.2

 compile 'com.google.firebase:firebase-messaging:11.4.2'
 compile 'com.google.firebase:firebase-firestore:11.4.2'
 compile 'com.google.firebase:firebase-appindexing:11.4.2'

之后,Clean-Rebuild-Run.

仅供参考

SDK Version 11.6.2 已启动。您可以使用 11.6.2 版本。

为了解决这个问题,您需要使用相同版本的依赖项,如下所示:

compile 'com.google.firebase:firebase-messaging:11.4.2'
compile 'com.google.firebase:firebase-firestore:11.4.2'
compile 'com.google.firebase:firebase-appindexing:11.4.2'

正如您可能看到的,现在所有依赖项都有 11.4.2 版本。

要解决您的问题,请更改:

 compile 'com.google.firebase:firebase-messaging:11.6.2'
 compile 'com.google.firebase:firebase-firestore:11.6.2'
 compile 'com.google.firebase:firebase-appindexing:11.6.2'

THE FIREBASE VERSION IS: 11.6.2 - November 27, 2017

但是你应该更新你的 gradle 文件:

... dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
...

现在,将 compile 更改为 implementation

 implementation 'com.google.firebase:firebase-messaging:11.6.2'
 implementation 'com.google.firebase:firebase-firestore:11.6.2'
 implementation 'com.google.firebase:firebase-appindexing:11.6.2'

最近我遇到了这个错误,我做了上面描述的所有甚至更多,但我找到了另一个解决方案。所以,我只想分享一下,即使你已经修复了它,因为人们在搜索答案时会首先看到你的 post。

在这里,你可以看到我得到的错误:

Error: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 11.8.0.

这是build.gradle(应用级别)

 apply plugin: 'com.android.application'

 android {
  compileSdkVersion 26
 defaultConfig {
     applicationId "idoston.com.firebaseauthenticationandroid"
     minSdkVersion 17
     targetSdkVersion 26
     versionCode 1
     versionName "1.0"
     testInstrumentationRunner 
     "android.support.test.runner.AndroidJUnitRunner"
     }
     buildTypes {
      release {
         minifyEnabled false
         proguardFiles getDefaultProguardFile('proguard-android.txt'), 
        'proguard-rules.pro'
        }
     }
 }

 dependencies {
     implementation fileTree(dir: 'libs', include: ['*.jar'])
     implementation 'com.android.support:appcompat-v7:26.1.0'
     implementation 'com.android.support.constraint:constraint-layout:1.0.2'
     implementation 'com.google.firebase:firebase-auth:11.0.4'
     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.android.support:percent:26.1.0'
     compile 'com.google.firebase:firebase-core:11.8.0'
     compile 'com.firebaseui:firebase-ui-auth:3.2.2'
  }
    apply plugin: 'com.google.gms.google-services'

解决方法是:你需要删除最后一行:

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

我希望这个回答可能对以后的人有所帮助。