6

I'm trying to build my new project, but I get this error:

Error:Execution failed for task ':mobile: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 9.0.0.

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

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.1"
    defaultConfig {
        applicationId "com.julia.android.example_project"
        minSdkVersion 10
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    buildTypes.each {
        it.buildConfigField 'String', 'API_KEY', myKey
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:25.0.1'
    ...
    compile 'com.google.android.gms:play-services:10.0.1'
    compile 'com.google.android.gms:play-services-gcm:10.0.1'
    compile 'com.google.android.gms:play-services-location:10.0.1'
    wearApp project(':wear')
}

And

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

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

I tried to move apply plugin: 'com.google.gms.google-services' at the bottom of my app/build.gradle file, but it didn't work out.

Any ideas, please?

Community
  • 1
  • 1
JuliaKo
  • 731
  • 1
  • 11
  • 19
  • check your sdk if there is any updates available for google play services. – Chirayu Dec 07 '16 at 05:47
  • please change your dependency all `'compile 'com.google.android.gms:play-services:9.8.0'` and add plugin to bottom and sync again, if it's work then as @Chirayu said you need to update your sdk – Farmer Dec 07 '16 at 05:51
  • I have Google Play services plugin Version 38 installed, I don't see how I can update it... – JuliaKo Dec 07 '16 at 05:54
  • @JuliaKo yes your play service is upto date. now make sure to add `apply plugin: 'com.google.gms.google-services'` at the bottom in your gradle. and also check google repository update. – Chirayu Dec 07 '16 at 05:58

7 Answers7

25

Had this issue earlier today. Just apply the google services plugin before you apply the android application plugin.

Update the following lines:

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

to:

apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'
DR Haus
  • 652
  • 1
  • 7
  • 12
  • 2
    it works, but don't know why I can't find any explanation on google doc. it really sucks ..... btw, thanks a lot. – Chauyan Aug 16 '17 at 06:40
5

I had the same issue, I solved it looking for all the "build.grade" files in the project to change all the versions from 9.8.0 to 10.0.1 (you can do a search "find in path" to search the 9.8.0 string), I had one missing and this caused the error.

And also the line:

compile 'com.google.android.gms:play-services-appindexing:9.8.0'

must be replaced by:

compile 'com.google.firebase:firebase-appindexing:10.0.1'
Fran
  • 417
  • 2
  • 6
  • 15
3

To fix this you have to do the following.

First, even if the documentation says "Add this"

 dependencies {
        compile 'com.google.android.gms:play-services:10.0.1'
 }

Don't do it, because that is the whole google play services API, since version 6.5 if I remember correctly google play services is a selective API, it means that you must include only what you need.

Read this page entirely until you read Selectively compiling APIs into your executable.

Second, check that all your version numbers are the same, you can't mix them; check the link before, and choose only what you need.

By the way the class path is

classpath 'com.google.gms:google-services:3.0.0'

Not beta-1 as @JuliaKo said.

P.S. If you speak Spanish, read my post about this here

Pedro Varela
  • 2,296
  • 1
  • 26
  • 32
2

In my case, check that not only google-play-services, but firebase services are of the same version as well.

htafoya
  • 18,261
  • 11
  • 80
  • 104
1

Put this line after dependencies closure at the bottom:

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

I solved this problem replacing this classpath 'com.google.gms:google-services:3.0.0' to this classpath 'com.google.gms:google-services:1.3.0-beta1'

JuliaKo
  • 731
  • 1
  • 11
  • 19
0

According to my own experience, you have to set that version to all the gms google services plugins. So, in your case you should replace

compile 'com.google.android.gms:play-services:10.0.1' compile 'com.google.android.gms:play-services-gcm:10.0.1' compile 'com.google.android.gms:play-services-location:10.0.1' for

compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.google.android.gms:play-services-gcm:9.0.0'
compile 'com.google.android.gms:play-services-location:9.0.0'

Besides, as other users have suggested, you have to add

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

at the bottom of the app.module graddle file

manuesev
  • 91
  • 1
  • 4