Similar questions have been asked a lot here and I have gone through all of what I can find and tried all of the solutions there.
The Problem
"All GMS/Firebase must use the exact same version" - I can see that there is a version conflict for the following Google Services libraries, which arent specifically written on any of the build.gradle files, against version 16.0.0 of the firebase core library:
- com.google.android.gms:play-services-ads-identifier-15.0.1
- com.google.android.gms:play-services-base-15.0.1
- com.google.android.gms:play-services-basement-15.0.1
- com.google.android.gms:play-services-measurement-base-15.0.4
- com.google.android.gms:play-services-stats-15.0.1
Here is my project level build.gradle and here is my app level build.gradle. As you can see, the error message comes from the firebase core dependency.
What I have done so far to check for existing Stack Overflow questions and solutions (mods, please review these attempts before saying that this question is a duplicate):
- This SO question provides a solution to make sure the latest Google Repository is installed under SDK Tools / Support Repository. Mine is the latest at version 58.
- The solution to this SO question and this was to increase the Firebase version to match the Google Services version. However, mine is the other way around (firebase version is higher than Google Services version). So when I try to downgrade the firebase version to the Google Services version, I get this error. However, I dont know how to upgrade the Google Services version because I have already upgraded the Google Services SDK tool to the latest and what I have added on the project level build.gradle (4.0.1) is the latest version as of today from Google's documentation.
- The solution to this SO problem was to keep all firebase dependency versions the same. I have only added one dependency so far (ie firebase-core) so it doesnt apply here.
- This one and this one says make sure to add
apply plugin: 'com.google.gms.google-services'
at the end of the app level build.gradle. I have already done that.