Google Play Services GCM 9.2.0 asks to "update" back to 9.0.0

AndroidGoogle Cloud-MessagingGoogle Play-Services

Android Problem Overview


So this morning I started updating to the latest version of my project libraries.

I'm trying to update GCM to the latest version 9.2.0, but I get this error:

> 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 9.0.0.

This is how I have my code:

dependencies {
    classpath 'com.android.tools.build:gradle:2.1.2'
    classpath 'com.google.gms:google-services:3.0.0'
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}

And then:

dependencies {
    ...

    compile "com.google.android.gms:play-services-gcm:9.2.0"

    ...
}

Anyone having the same issue/fixed the same issue?

Thanks.

EDIT

Apparently you have to apply your GSM plugin at the bottom of your app/build.gradle file. Else, version 9.2.0 will cause conflict in your project.

For reference, this is how my app/build.gradle file looks like now:

apply plugin: "com.android.application"
apply plugin: "com.neenbedankt.android-apt"

android {
    ...
}

dependencies {
    ...

    // Google Cloud Messaging
    compile "com.google.android.gms:play-services-gcm:9.2.0"

    ...
}

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

Android Solutions


Solution 1 - Android

Do you have the line

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

line at the bottom of your app's build.gradle file?

I saw some errors when it was on the top and as it's written here, it should be at the bottom.

Solution 2 - Android

Just put this line at the bottom of your app-module's (not project root's) gradle file.

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

Then rebuild your project.

Solution 3 - Android

I had the same problem, today 2016 - october - 06 I solved with this:

I changed all dependencies that began with 9.?.? to 9.6.1 I compiled with sdk version 24 and target version 17.

There is another packages in my solution because I used more things then only authentication.

After changed your build.gradle (Module:app) with the code below do it:

  1. Put your package NAME in the line with the words applicationId "com.YOUR_PACKAGE_HERE"

  2. Synchronize your project (Ctrl+alt+v) and Build Again.

This is the code of the file buid.gradle (Module:app) that worked for me:

apply plugin: 'com.android.application'

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

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.google.firebase:firebase-core:9.6.1'
    compile 'com.google.firebase:firebase-database:9.6.1'

    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.android.support:design:24.2.1'

    compile 'com.google.firebase:firebase-crash:9.6.1'
    testCompile 'junit:junit:4.12'

    compile 'com.google.firebase:firebase-messaging:9.6.1'

    compile 'com.google.firebase:firebase-ads:9.6.1'


    compile 'com.google.firebase:firebase-auth:9.6.1'


    compile 'com.google.android.gms:play-services:9.6.1'

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

Solution 4 - Android

The same situation was with the previous versions. It's annoing that new versions com.google.android.gms libraries are always releasing before plugin, and it's impossible to use new version because is incompatible with old plugin. I don't know if plugin is now required (google docs sucks). I remember times when it wasn't. The only way is wait for new plugin version, or you can try to remove plugin dependencies, but as I said I'am not sure if gcm will work without it. What I know the main feature of 9.2.0 version is new Awareness API https://inthecheesefactory.com/blog/google-awareness-api-in-action/en, if you didn't need it, you can use 9.0.0 version without any trouble.

Solution 5 - Android

Gustavomcls's solution to change com.google.* version to same version worked for me .

I change both dependancies to 9.2.1 in buid.gradle (Module:app)

compile 'com.google.firebase:firebase-ads:9.2.1'
compile 'com.google.android.gms:play-services:9.2.1'

Solution 6 - Android

open app/build.gradle from your app-module and rewrite below line after dependencies block. This allows the plugin to determine what version of Play services you are using

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

I got this idea from here. In this tutorial second point is saying that above plugin line be at the bottom of your app/build.gradle file so that no dependency collisions are introduced. Hope it will help you out.

Solution 7 - Android

> For Cordova OR Ionic Hybrid App > ===============================

I have the very similar problem with my Ionic 1 Cordova Build after Integrating the Firebase Cloud Messaging ( FCM )

I fixed this issue by the following steps

So one fix will be: inside platforms/android open project.properties (Its a file ) , you will have something like this

cordova.system.library.1=com.google.android.gms:play-services-ads:+
cordova.system.library.2=com.google.firebase:firebase-core:+
cordova.system.library.3=com.google.firebase:firebase-messaging:+

Replace the

> +

Sign with your target version number - like the following

cordova.system.library.1=com.google.android.gms:play-services-ads:9.0.0
cordova.system.library.2=com.google.firebase:firebase-core:9.0.0
cordova.system.library.3=com.google.firebase:firebase-messaging:9.0.0

Save the file

Then take build using

> ionic cordova run android

I hope this will work for everyone

Solution 8 - Android

Add this line at the bottom of the gradle.

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

because it the top it does not work.I was facing similar problem.

Solution 9 - Android

if you have Firebase included also, make them of same version as the error says.

Solution 10 - Android

I didn't have an issue with this until I tried to use the Location Services, at which point I had to put the apply plugin: 'com.google.gms.google-services' at the bottom of the file, rather than the top. The reason being that when you have it at the top there are collision issues, and by placing it at the bottom, you avoid those issue.

Solution 11 - Android

Your target SDK might be higher than SDK of the device, change that. For example, your device is running API 23 but your target SDK is 25. Change 25 to 23.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionherrmartellView Question on Stackoverflow
Solution 1 - AndroidGusthemaView Answer on Stackoverflow
Solution 2 - AndroidVikasView Answer on Stackoverflow
Solution 3 - AndroidGustavomclsView Answer on Stackoverflow
Solution 4 - Androidyaneq6View Answer on Stackoverflow
Solution 5 - AndroidRahul BagalView Answer on Stackoverflow
Solution 6 - AndroidRahul SharmaView Answer on Stackoverflow
Solution 7 - Androidsijo vijayanView Answer on Stackoverflow
Solution 8 - AndroidMudassir KhanView Answer on Stackoverflow
Solution 9 - AndroidsrlgrgView Answer on Stackoverflow
Solution 10 - AndroidBlackHatSamuraiView Answer on Stackoverflow
Solution 11 - AndroidMohit MishraView Answer on Stackoverflow