Error: fix the version conflict (google-services plugin)

143,169

Solution 1

I think you change

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

Solution 2

Same error gets thrown when

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

is not added to bottom of the module build.gradle file.

Solution 3

You must use only one version for all 3 libs

compile 'com.google.firebase:firebase-messaging:11.0.4'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'

OR only use only 10.0.1 for 3 libs

Solution 4

Please change your project-level build.gradle file in which you have to change your dependencies class path of google-services or build.gradle path.

buildscript {

    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:4.0.1'
    }
}

Solution 5

The google play services requires all its dependencies to have the same version. But if you look at your dependencies:

compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'

There is one that has a different version.

It can be solved by changing the version to (in this case) 11.0.4.

This applies to both Firebase and Google Play Services - both have to have matching versions that also correspond with each other. If a Firebase dependency is 10.0.1 and a Google Play Services dependency is 11.0.4, the same error will occur.

Note that in some cases, there can be a library that has a different version of a library (e.g. library x uses play-services-games:10.0.1 while you use 11.0.4 for the dependencies in your app)


Edit

This answer does NOT cover the newer versions where versions are individual. Update com.google.gms:google-services:4.1.0 and check mvnrepository (or some other maven/gradle artifact search tool) to find the newest versions.

Share:
143,169
Faizan Mubasher
Author by

Faizan Mubasher

Senior Software Engineer. .NET Core Android React Native ReactJS

Updated on July 05, 2022

Comments

  • Faizan Mubasher
    Faizan Mubasher almost 2 years

    As per this SO thread, I know there are version conflicts, but issue still persists after new versions from Google.

    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.

    My build.gradle(Module: app)

    ....
    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:26.+'
       compile 'com.android.support.constraint:constraint-layout:1.0.2'
       testCompile 'junit:junit:4.12'
       compile 'com.google.firebase:firebase-messaging:10.0.1'
       compile 'com.google.android.gms:play-services-maps:11.0.4'
       compile 'com.google.android.gms:play-services-location:11.0.4'
    }
    
    apply plugin: 'com.google.gms.google-services'
    


    What changes are required now?

  • Faizan Mubasher
    Faizan Mubasher almost 7 years
    So, only this was the issue! I wish I had tried it before posting :\
  • Infinite Loops
    Infinite Loops over 6 years
    Make sure all Firebase SDK version is as same as play services version.
  • Farwa
    Farwa about 6 years
    I was having the same kind of issue but all my version numbers were updated. After few minutes I discovered that it was giving error because I had put apply plugin: 'com.google.gms.google-services' at the bottom. As soon as I placed it at bottom it worked. Can someone explain me why it happened?
  • Desolator
    Desolator about 6 years
    this worked for me, I just added it to the bottom of the file
  • sqlchild
    sqlchild almost 6 years
    how to do this resolution on phonegap build
  • Guy Moreillon
    Guy Moreillon almost 6 years
    Saved me! One has to wonder why Gradle smells so much like black magic though.
  • Brad Martin
    Brad Martin over 5 years
    amazing. Spent hours trying to figure out a build issue bc firebase was trying to use 17x and play-services-location was 16x. Thanks
  • Khemraj Sharma
    Khemraj Sharma about 5 years
    Update, One can use individual versions stackoverflow.com/a/54593656/6891563
  • Khemraj Sharma
    Khemraj Sharma about 5 years
    Update, latest dependencies may have individual versions. stackoverflow.com/a/54593656/6891563
  • Various Artist
    Various Artist about 5 years
    How to fix this in an Ionic/Cordova build?
  • ahmed hamdy
    ahmed hamdy almost 5 years
    I wounder why setting plugin line on the top of Gradle will make an error and setting it at the bottom of file will work correct ??? Is there any one known the actual reason .
  • Wimukthi Rajapaksha
    Wimukthi Rajapaksha over 4 years
    it's better to check maven repository versions from this link and change versions.