Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 966
Faizan Mubasher Avatar asked Aug 04 '17 07:08

Faizan Mubasher


5 Answers

I think you change

compile 'com.google.firebase:firebase-messaging:11.0.4'
like image 196
Adil Saiyad Avatar answered Nov 15 '22 23:11

Adil Saiyad


Same error gets thrown when

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

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

like image 40
Arnav Rao Avatar answered Nov 16 '22 00:11

Arnav Rao


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

like image 30
Nguyễn Trung Hiếu Avatar answered Nov 15 '22 23:11

Nguyễn Trung Hiếu


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'
    }
}
like image 21
Pinak Gauswami Avatar answered Nov 16 '22 01:11

Pinak Gauswami


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.

like image 19
Zoe stands with Ukraine Avatar answered Nov 16 '22 00:11

Zoe stands with Ukraine