使用app:processDebugGoogleServices'执行失败

时间:2017-12-06 10:09:20

标签: android firebase dependencies google-cloud-firestore gradle-plugin

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

  

“错误:任务'执行失败':app:processDebugGoogleServices'。>   请通过更新版本来修复版本冲突   google-services插件(有关最新版本的信息是   可在   https://bintray.com/android/android-tools/com.google.gms.google-services/)   或将com.google.android.gms的版本更新为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
}

请帮我解决这个问题我尽我所能。

4 个答案:

答案 0 :(得分:1)

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

AService

THE FIREBASE VERSION IS: 11.6.2 - November 27, 2017

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

 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'

现在,更改... dependencies { classpath 'com.android.tools.build:gradle:3.0.1' ... 的{​​{1}}:

compile

答案 1 :(得分:0)

读取错误日志

  

"错误:任务':app:processDebugGoogleServices'执行失败。 >   请通过更新版本来修复版本冲突   谷歌服务插件

您应该使用 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.

<强> FYI

SDK Version 11.6.2已经发布。您可以使用 11.6.2 版本。

答案 2 :(得分:0)

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

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版本。

答案 3 :(得分:0)

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

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

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'

我希望这个答案可能会对将来有所帮助。