Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

com.google.android.gms:play-services-measurement-base is being requested by various other libraries

I updated to gradle 4.0.1 and started receiving following error

The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[15.0.4,15.0.4]], but resolves to 15.0.2. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

My project doesn't use that dependency so I searched globally for it, and it it only comes up inside

build/intermediates/lint-cache/maven.google/com/google/android/gms/group-index.xml

as this line

<play-services-measurement-base versions="15.0.0,15.0.2"/>

So I tried deleting my build folder and cleaning the project, but it regenerates it with same values :/ hence error still remains

like image 504
Ilja Avatar asked May 29 '18 06:05

Ilja


19 Answers

only working solution for me:

put it on the bottom of build.gradle

com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
like image 33
htw Avatar answered Oct 04 '22 15:10

htw


You can find the library pulling this dependancy using:

$ ./gradlew app:dependencies
like image 53
Nico Avatar answered Oct 04 '22 15:10

Nico


Make Sure to keep Your Google play services dependencies and Firebase dependencies to latest version.

Also check all your gradle files, module level and project level, there has to be only one common version of dependency across all modules. Can be solved by keeping those versions in project level gradle variable.

Check here for Google play services update version

Google Play Services Latest

Check here for Firebase updated version

Firebase Latest

Check here for Firebase updated version for Android

Firebase Android Latest

like image 38
abitcode Avatar answered Oct 04 '22 16:10

abitcode


I updated

implementation 'com.google.android.gms:play-services-analytics:16.0.3'

and it works for me

like image 32
Amine M'hamed Avatar answered Oct 04 '22 15:10

Amine M'hamed


changing my build.gradle to the following worked for me:

ext {
  googlePlayServicesVersion   = "15.0.1"
}

allprojects {
  repositories {
      mavenLocal()
      maven { url 'http://maven.google.com' }
      jcenter { url "http://jcenter.bintray.com/" }
      google()
      maven {
        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
        url "$rootDir/../node_modules/react-native/android"
      }

      configurations.all {
        resolutionStrategy {
            force "com.google.android.gms:play-services-basement:$googlePlayServicesVersion"
            force "com.google.android.gms:play-services-tasks:$googlePlayServicesVersion"
        }
      }
  }
}
like image 30
mk7danny Avatar answered Oct 04 '22 15:10

mk7danny


In my case using latest versions of following dependencies solved my issue:

'com.google.android.gms:play-services-analytics:16.0.1'
'com.google.android.gms:play-services-tagmanager:16.0.1'
like image 32
Murat Avatar answered Oct 04 '22 17:10

Murat


This can happen if your Android Gradle plugin is very old, even if you are only using a single Google lib! Apparently all Google libs used to need to be the exact same version. Now they don't need to be the same, only the latest. When specifying even a single lib, it pulls in dependencies where the versions don't match and the old Android Gradle plugin pukes.

Set a newer version like:

buildscript {
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
    }
}

You may need update your Gradle to use the newer plugin (it will tell you).

like image 41
NateS Avatar answered Oct 04 '22 17:10

NateS


I was having an error The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[16.0.2,16.0.2]], but resolves to 16.0.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

Running ./gradlew :app:dependencies will reveal what dependencies are requiring wrong dependencies (the ones in the square bracket). For me the problem was coming from firebase-core:16.0.3 as shown below. I fixed it by downgrading firebase-core to 16.0.1

+--- com.google.firebase:firebase-core:16.0.3
|    +--- com.google.firebase:firebase-analytics:16.0.3
|    |    +--- com.google.android.gms:play-services-basement:15.0.1
|    |    |    \--- com.android.support:support-v4:26.1.0 (*)
|    |    +--- com.google.android.gms:play-services-measurement-api:[16.0.1] -> 16.0.1
|    |    |    +--- com.google.android.gms:play-services-ads-identifier:15.0.1
|    |    |    |    \--- com.google.android.gms:play-services-basement:[15.0.1,16.0.0) -> 15.0.1 (*)
|    |    |    +--- com.google.android.gms:play-services-basement:15.0.1 (*)
|    |    |    +--- com.google.android.gms:play-services-measurement-base:[16.0.2] -> 16.0.2
like image 41
Eric Kim Avatar answered Oct 04 '22 17:10

Eric Kim


Only solution that work for me (found some where in SOF)(don't have the link) is :

in top main build.grale

allprojects {

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.google.android.gms'
                    && !details.requested.name.contains('multidex')) {
                details.useVersion "x.y.z"
            }
        }
    }
}
like image 39
issamux Avatar answered Oct 04 '22 16:10

issamux


Add to list of your dependencies. Now need to have it for proper work of all firebase dependencies:

implementation 'com.google.firebase:firebase-core:16.0.1'
like image 20
PavelGP Avatar answered Oct 04 '22 15:10

PavelGP


I had the same issue

Just make sure that you have the latest versions of all the dependencies. I used the current versions for Firebase core and auth. The newer versions have bug fixes.

You can get the latest versions from here : https://firebase.google.com/support/release-notes/android

Using the latest version at current point of time:

in app/build.gradle :

dependencies {
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-auth:16.1.0'
}
like image 23
shellym Avatar answered Oct 04 '22 16:10

shellym


A similar issue arose with me when I tried to add Firebase Database to my project.

implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.3'

The issue can be resolved by downgrading or upgrading both the versions to a similar level. So I downgraded firebase database to

implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'

and it worked! All available versions can be searched on this site: https://mvnrepository.com/

like image 27
Harshit Agarwall Avatar answered Oct 04 '22 15:10

Harshit Agarwall


For me this error appeared after integrating Crashlytics via Firebase, due to a conflict of versions between

implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.android.gms:play-services-location:15.0.1'

I first tried downgrading Firebase Core to 15.0.1, but it seems there is no such version, only 15.0.0 and 15.0.2! Instead I had to downgrade both to version 15.0.0, so I ended up with

implementation 'com.google.firebase:firebase-core:15.0.0'
implementation 'com.google.android.gms:play-services-location:15.0.0'

So now it's working, but I get those annoying Lint warnings about newer versions being available. This versioning debacle is a freakin' mess.

like image 2
Magnus Avatar answered Oct 04 '22 15:10

Magnus


In my case I have replaced my build.gradle file this line

implementation 'com.google.firebase:firebase-core:16.0.8'

with

implementation 'com.google.firebase:firebase-core:15.0.0' 

and added this line

implementation 'com.google.android.gms:play-services-location:15.0.0'

Now its fine

like image 2
Maddu Swaroop Avatar answered Oct 04 '22 15:10

Maddu Swaroop


I was bumping into this problem, and noticed that the release notes mentioned:

Firebase now requires the app gradle file to explicitly list com.google.firebase:firebase-core as a dependency for Firebase services to work as expected.

Making firebase-core an app dependency (as well as a library dependency) resolved this problem for me.

like image 1
Tad Avatar answered Oct 04 '22 16:10

Tad


1. Open project level build.gradle

Update com.google.gms:google-services version to latest. Track latest release. At the time of answer latest is 4.1.0.

2. Open app level build.gradle

Update below dependency if you use any. Note that firebase has individual versions for every dependency now.

Use latest Firebase Libraries. At the time of answer latest versions are below.

Firebase Core                com.google.firebase:firebase-core:16.0.3
Ads                          com.google.firebase:firebase-ads:15.0.1
Analytics                    com.google.firebase:firebase-analytics:16.0.3
App Indexing                 com.google.firebase:firebase-appindexing:16.0.1
Authentication               com.google.firebase:firebase-auth:16.0.3
Cloud Firestore              com.google.firebase:firebase-firestore:17.1.0
Cloud Functions              com.google.firebase:firebase-functions:16.1.0
Cloud Messaging              com.google.firebase:firebase-messaging:17.3.2
Cloud Storage   c            om.google.firebase:firebase-storage:16.0.2
Crash Reporting              com.google.firebase:firebase-crash:16.2.0
Crashlytics                  com.crashlytics.sdk.android:crashlytics:2.9.5
Dynamic Links                com.google.firebase:firebase-dynamic-links:16.1.1
Invites                      com.google.firebase:firebase-invites:16.0.3
In-App Messaging             com.google.firebase:firebase-inappmessaging:17.0.1
In-App Messaging Display     com.google.firebase:firebase-inappmessaging-display:17.0.1
ML Kit: Model Interpreter    com.google.firebase:firebase-ml-model-interpreter:16.2.0
ML Kit: Vision               com.google.firebase:firebase-ml-vision:17.0.0
ML Kit: Image Labeling       com.google.firebase:firebase-ml-vision-image-label-model:15.0.0
Performance Monitoring       com.google.firebase:firebase-perf:16.1.0
Realtime Database            com.google.firebase:firebase-database:16.0.2
Remote Config                com.google.firebase:firebase-config:16.0.0

Sync and Build...

like image 1
Khemraj Sharma Avatar answered Oct 04 '22 16:10

Khemraj Sharma


I noticed that debug logs mention old version of firebase-analytics (16.0.0). Adding explicitly the latest version fixed the problem:

implementation "com.google.firebase:firebase-analytics:16.0.3"
like image 1
smok Avatar answered Oct 04 '22 15:10

smok


Update all your dependencies to the latest version and it will fix the issue.

No need to add
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

It will lead to crashes if you use mixed versions.

like image 1
RakeshGupta Avatar answered Oct 04 '22 16:10

RakeshGupta


I guess the following error is caused because of the varying versions of firebase dependencies. For me changing the version of all the dependencies that i'm implementing on my project to 16.0.1, worked like a charm.

For me the error was created by the line: com.google.firebase:firebase-auth:16.0.2

And I changed it to : com.google.firebase:firebase-auth:16.0.1

And it worked.. Hope this helps.

like image 1
Vipin George Avatar answered Oct 04 '22 17:10

Vipin George