How to fix google play service error

Firebase Android SDKs now have independent version numbers, allowing for more frequent, flexible updates.

Update the google play gradle plugin version to latest version, currently 3.3.0.

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

and update the libraries to the latest version.

Firebase Core   com.google.firebase:firebase-core:15.0.2
Ads             com.google.firebase:firebase-ads:15.0.0
Analytics       com.google.firebase:firebase-analytics:15.0.2
App Indexing    com.google.firebase:firebase-appindexing:15.0.0
Authentication  com.google.firebase:firebase-auth:15.1.0
Cloud Firestore com.google.firebase:firebase-firestore:16.0.0
Cloud Functions com.google.firebase:firebase-functions:15.0.0
Cloud Messaging com.google.firebase:firebase-messaging:15.0.2
Cloud Storage   com.google.firebase:firebase-storage:15.0.2
Crash Reporting com.google.firebase:firebase-crash:15.0.2
Crashlytics     com.crashlytics.sdk.android:crashlytics:2.9.1
Invites         com.google.firebase:firebase-invites:15.0.2
Performance Monitoring  com.google.firebase:firebase-perf:15.1.0
Realtime Database   com.google.firebase:firebase-database:15.0.0
Remote Config   com.google.firebase:firebase-config:15.0.2

Also as reported use at least the version 15.0.2:

You will need to update the version of the latter dependency to 15.0.2. This addresses the issue where version 3.3.0 of the Google Services Gradle plugin reports: The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[15.0.0,15.0.0], [15.0.2,15.0.2]], but resolves to 15.0.2...


For me i needed to update com.google.android.gms:play-services-base to version 15.0.1 instead of 15.0.0.

implementation "com.google.android.gms:play-services-base:15.0.1"


Try this is working for me.

Add this in your build.gradle end of file

com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

With google play service. Version 4.3.0

googleServices.disableVersionCheck = true

One of your dependency is having different version of com.google.android.gms.

Update

Firebase dependencies are having independent versions unlike past. If you have version conflicts then you can update your com.google.gms:google-services. and start defining independent version.

Update com.google.gms:google-services

Go to top (project) level build.gradle and update com.google.gms:google-services to version 4.1.0 or newer if available.

buildscript {
    ...
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'
        classpath 'com.google.gms:google-services:4.1.0' //< update this 
    }
}

Update Firebase dependencies to Latest Versions

Firebase dependency versions can be individual. So check Latest Versions.

com.google.firebase:firebase-core:16.0.3    //Analytics
com.google.firebase:firebase-database:16.0.2    //Realtime Database

Orignal Solution (Useful)

Ways to resolve:

  1. Exclude com.google.android.gms from conflicted dependency.
  2. Update that dependency if available.
  3. Change your com.google.android.gms version as conflicted version.

Problem

how to see which dependency is using com.google.android.gms?

1. Solution by command

For Android, use this line

 gradle app:dependencies

or if you have a gradle wrapper:

./gradlew app:dependencies

where app is your project module.

Additionally, if you want to check if something is compile vs. testCompile vs androidTestCompile dependency as well as what is pulling it in:

./gradlew :app:dependencyInsight --configuration compile --dependency <name>
./gradlew :app:dependencyInsight --configuration testCompile --dependency <name>
./gradlew :app:dependencyInsight --configuration androidTestCompile --dependency <name>

2 Use these plugins

Gradle View is an Android Studio plugin that you can install and show dependency hierarchy. Methods Count is another plugin, it also shows dependency tree.