Error: fix the version conflict (google-services plugin)
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.
Faizan Mubasher
Senior Software Engineer. .NET Core Android React Native ReactJS
Updated on July 05, 2022Comments
-
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 almost 7 yearsSo, only this was the issue! I wish I had tried it before posting :\
-
Infinite Loops over 6 yearsMake sure all Firebase SDK version is as same as play services version.
-
Farwa about 6 yearsI 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 about 6 yearsthis worked for me, I just added it to the bottom of the file
-
sqlchild almost 6 yearshow to do this resolution on phonegap build
-
Guy Moreillon almost 6 yearsSaved me! One has to wonder why Gradle smells so much like black magic though.
-
Brad Martin over 5 yearsamazing. 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 about 5 yearsUpdate, One can use individual versions stackoverflow.com/a/54593656/6891563
-
Khemraj Sharma about 5 yearsUpdate, latest dependencies may have individual versions. stackoverflow.com/a/54593656/6891563
-
Various Artist about 5 yearsHow to fix this in an Ionic/Cordova build?
-
ahmed hamdy almost 5 yearsI 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 over 4 yearsit's better to check maven repository versions from this link and change versions.