Search code examples
androidgradlegoogle-play-servicesbintrayjcenter

play-services-measurement-base version mismatch between google and maven repository


I'm trying to build an android react native app where we use both Google Analytics and Firebase and I ran into this issue when compiling:

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

After analysis of our gradle scan (see pictures below), we found that we have one module requiring com.google.firebase:firebase-coreand another one requiring com.google.android.gms:play-services-analytics.

Both of these modules requires play-services-measurement-base but since these modules are downloaded on the different repository (one is google and the other one is maven). We noticed that version 16.0.2 is released only on google repository but not on maven's one (check images below).

https://mvnrepository.com/artifact/com.google.android.gms/play-services-measurement-base

https://dl.google.com/dl/android/maven2/index.html

We tried to disable dependencies check with no luck. If anyone has a solution for this issue or a way to contact google/maven about this issue.

  • Versions:
    • Gradle: 4.4
    • Gradle Android Tools: 3.1.3
    • Gradle Google Services plugin: 4.0.1
    • Android SDK Version: 27
    • Buildscript Repositories: google(), jcenter()

TEMPORARY SOLUTION: Explicitly exclude play-services-measurement-base from Firebase like this: implementation("com.google.firebase:firebase-core:16.0.1") { exclude group: 'com.google.android.gms', module: 'play-services-measurement-base' } OR check the accepted answer.


Solution

  • you can either force the resolution to a specific version number:

    configurations.all() {
        resolutionStrategy.force "com.google.android.gms:play-services-measurement-base:16.0.2"
    }
    

    or exclude version 16.0.0 from the conflicting module com.google.firebase:firebase-core.