com.google.android.gms:play-services-measurement-base is being requested by various other libraries
Solution 1
The actual problem is discussed in the May, 23rd release note of https://developers.google.com/android/guides/releases#may_23_2018
Basically, you need to bump all Play Services and Firebase libraries to their latest version (which may be different for each since version 15). You may use https://mvnrepository.com/ to find the latest version for each library.
See also: https://firebase.google.com/support/release-notes/android#20180523
Solution 2
only working solution for me:
put it on the bottom of build.gradle
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
Solution 3
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
Check here for Firebase updated version
Check here for Firebase updated version for Android
Solution 4
I updated
implementation 'com.google.android.gms:play-services-analytics:16.0.3'
and it works for me
Solution 5
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"
}
}
}
}
Related videos on Youtube
![Ilja](https://i.stack.imgur.com/HtpZB.jpg?s=256&g=1)
Comments
-
Ilja over 3 years
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
-
Priya Rajan over 5 yearsResolved here: Me too faced the same problem when trying to add crashlytics in firebase. Please update the latest version of dependencies for com.google.android.gms:play-services and com.google.firebase: ....... It will automatically resolved the issues
-
landrykapela over 5 yearsI had the latest version and got this error so downgraded to 15.0.1 and it worked!
-
Patricio Sard over 5 yearsPlease go to this issue and star it. It seems there are a lot of problems because there were a lot of libraries unpublished from jCenter.
-
-
PaulR about 6 yearsmaven.google.com is also suitable for looking up the released versions of these libraries.
-
ARLabs about 6 yearsFor me this solution hide the message, that is then raised in another way: "Android dependency 'com.google.android.gms:play-services-measurement-base' has different version for the compile (15.0.4) and runtime (16.0.0) classpath. You should manually set the same version via DependencyResolution"
-
jasonhudgins about 6 yearsThis isn't working, it's just spits out the same error with no dependency graph.
-
Dibzmania almost 6 yearsLifeSaver. Google should streamline this versioning. It's a pain
-
Jacob Joel almost 6 yearsYour answer helped me figure this out. But I had to use this post to actually get the correct versions included in my project and get past the errors.
-
Kata Lune almost 6 yearsyou need to remove apply plugin: 'com.google.gms.google-services' line before trying this to avoid showing error
-
miszmaniac almost 6 yearsI disabled the plugin, and checked dependencies. But there wasn't any library that had dependency to 15.0.4 as stated in exception
The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[15.0.4,15.0.4], [16.0.0,16.0.0]], but resolves to 16.0.0.
-
NoHarmDan almost 6 years@miszmaniac I had the exact same issue. Downgrading both
play-services-analytics
andfirebase-core
to16.0.0
solved the issue. -
miszmaniac almost 6 yearsThis new system of non equal versions for Firebase library is tragedy for now. Yesterday we had a random crash at app start, because firebase was not able to init() for some odd reason... we had to disable (in manifest) firebase-perf to be able to remove crash
-
Eric Kim almost 6 yearsnow I am getting different error
The library com.google.firebase:firebase-analytics is being requested by various other libraries at [[16.0.3,16.0.3]], but resolves to 16.0.1. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
-
Student almost 6 yearsI used the latest version of all libraries but the error remains.
-
Nguyễn Anh Tuấn almost 6 yearsThank you. I did the same thing, it's work very well.
-
Neri over 5 yearsIts the only solution that worked for me. Even with all gradle libraries up to date.
-
mmmatey over 5 yearsDon't ever do that. It's very bad answer, it can lead to multiple crashes and changes which you will never now.. because this will always request new version of library.
-
pmont over 5 yearsIt works, but use it as a last resort. I sync'd all the Google Play and Firebase versions, but one library refused to accept that version (it was hardcoded to require one and only one specific version).
-
Dane Lowrey over 5 yearsI had the same issue and used the mvnreposityory.com to find the latest google versions of the libraries in both of my gradle.build files and my issues were resolved.
-
Lassi Kinnunen over 5 yearsjust saying that using the latest version should not be a problem. But it will probably be. this whole problem comes from trying to use latest versions.
-
Danish over 5 yearsthank you, it was helpful for me and solved my error. atleast gave me direction for next errors which i put them in same resolutionStrategy
-
Kimi Chiu over 5 yearsHere's a joke,
Firebase Android SDKs now have independent version numbers, allowing for more frequent, flexible updates.
. -
Aaron over 5 yearsTo clarify, it's adding the
ext {...}
block to force the version that fixes the issue -
user3369427 over 5 yearsIf you update all the libraries to their latest respective versions you get a warning that says "All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes)." Is this expected? How do you resolve this as well as the original problem?
-
user2529011 over 5 years@htw thats a nope for me.
-
gauravsngarg over 5 yearsWorked for me after searching lot of articles. Error was coming while adding firebase database. Thank you
-
Martin Zeitler over 5 yearsthis is the worst one can do; ignoring the problem is not a "solution".
-
Gesh over 5 yearsThis should be the accepted answer. Google just replaced their internal pain of releasing and testing many libs at the same version, with the pain of every other Android engineer having to deal with their inconsistencies!
-
Devansh Maurya over 5 yearsCan I thank you more? The solution helped me to save hours of work :)
-
publicknowledge over 5 yearsthis was useful. Using react-native and had to update the packages we were using to latest in these links.
-
NateS over 5 yearsIt can happen even if you depend on only a single Google lib! See my answer for why (very old Android Gradle plugin).
-
Kapil Soni about 5 years@Gowthaman M : sir i got error after put above in the build.gradle--- error: cannot find symbol public class FirebasePluginInstanceIDService extends FirebaseInstanceIdService {
-
hitautodestruct about 5 yearsnot working for me, it just gives me a different error
-
leeCoder over 4 yearsthis is where the magic lies. All dependencies in the app/build.gradle and then the topmost build.gradle file update all dependencies
-
Anand_5050 over 4 yearswhere i need to put this line ?
-
SriTeja Chilakamarri over 4 yearsThank you, using these versions got my problem solved.
-
Prajna almost 4 yearsin android/app/build.gradle @Anand_5050
-
Cícero Moura over 2 yearsThe best way to found out the solution ever!