Failed to Resolve Com.Google.Android.Gms Play-Services-Auth:11.4.0

Gradle failed to resolve com.google.android.gms:play-services-auth:11.6.0

I had the same issue and I was able to resolve it by adding maven { url "https://maven.google.com" } to list of repositories in project level build.gradle as shown below.

allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
}
}

Also, ensure this apply plugin: 'com.google.gms.google-services' comes after your dependencies to avoid version issues.

Failed to resolve: com.google.android.gms:play-services in IntelliJ Idea with gradle

I just replaced version 11.2.0 with 11.0.0 and then it seemed to work fine, so that had to mean that 11.2.0 wasn't included with the latest Android SDK.

So, after struggling with all the available scattered documentation, I reached this document by pure chance (I guess it is not indexed high enough by Google):
https://developers.google.com/android/guides/releases

I quote from there:

Highlights from the Google Play services 11.2 release. Google Play
services dependencies are now available via maven.google.com

Now, even when that shouldn't necessarily mean that they are not available with the downloaded SDK anymore, it seems that this is actually the case.

Anyway, adding google() to my build.gradle didn't work (not found, undefined, or whatever...), so I used a different approach that I found in this document referenced from the previous one:

https://developer.android.com/studio/build/dependencies.html#google-maven

I modified my build.gradle file adding that line to allprojects/repositories, as in:

allprojects {
...
repositories {
...
maven { url "https://maven.google.com/"}
}
}

And then also in the android section in the same build.gradle file:

project(":android") {
...
dependencies {
...
compile 'com.google.android.gms:play-services-ads:11.2.0'
}
}

Those two lines were enough to make Gradle sync without problems. I didn't need to add any plugins apart from the ones that are already added in my libGDX project by default.

After that, I got a few different errors, but none about Gradle or dependencies. In a brief, JFTR:

First, I had a minSdkVersion of 8. Solved by raising it to 14. I think I could live without supporting all those devices below 14.

Second, I had problems with the dex upper limit of references. I've never faced this problem before, but maybe you've already noticed the solution I used: instead of compiling the whole 'com.google.android.gms:play-services' I used only 'com.google.android.gms:play-services-ads' that's the API I'm actually interested right now. For those other particular cases where a solution like this may not be useful, this document could provide some better insight: https://developer.android.com/studio/build/multidex.html

Third, even after that I got this "jumbo" thing problem described and answered here: https://stackoverflow.com/a/26248495/1160360

And that's it. As of now, everything builds and my game does finally shows those Admob banners.

I've spent hours with this, thought, which makes me wonder if all these building automation systems we are using lately are worth the extra load they add.

I mean, the first time I had to add Admob to an app five years ago or so, I just had to download a .jar file and put it on a directory on my project. It was pretty obvious and the whole process, from googling "how to setup Admob in my android project" to have my app showing an Admob banner took me just a few minutes. I'm gonna leave it here, since this is not the place for such kind of debate.

Nonetheless, I hope my own experience is useful for someone else further.

How to fix google play service error

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.

Failed To Resolve: com.google.firebase:firebase-firestore:11.4.2

You're missing the google maven repo in your allprojects block:

allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
}

If you're using Gradle 4.1 or later, you can simplify it:

allprojects {
repositories {
jcenter()
google()
}
}

allprojects repositories is what's used to locate modules for your app. In buildscript, it locates modules for gradle plugins only.

Also, you should make sure all of your Firebase modules have the same version.

Failed to resolve: com.google.firebase:firebase-auth:11.4.0

Include this in your root-level(not the app level) bulid.gradle file:

allprojects {
// ...
repositories {
// ...
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}

For more instructions check the Firebase Integration Guide.

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

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



Related Topics



Leave a reply



Submit