Home » Android » android – Gradle unable to resolve Play services dependency

android – Gradle unable to resolve Play services dependency

Posted by: admin April 23, 2020 Leave a comment

Questions:

I’ve got a clean Android project with Google Play services rev. 13 installed through the SDK manager, following these instructions.

My build.gradle file is as follows:

dependencies {
    compile 'com.google.android.gms:play-services:4.0.30'
}

However, when I attempt to build this app, I get

Gradle: A problem occurred configuring project ':Maple'.
> Failed to notify project evaluation listener.
   > Could not resolve all dependencies for configuration ':Maple:_DebugCompile'.
      > Could not find com.google.android.gms:play-services:4.0.30.
        Required by:
            MapleProject:Maple:unspecified
How to&Answers:

Install the Google Repository in the SDK manager.

Answer:

Even if you have installed Google Repository in SDK Manager, you might still see the same error.

Another possible solution is to downgrade your version.

For example, instead of

compile 'com.google.android.gms:play-services:11.2.0'

Do

compile 'com.google.android.gms:play-services:11.0.4'

Notice 11.2.0 is advertised in Google’s Set up Google Play Services page but it does not work for me.

Answer:

Are you testing on Avd (Emulator or device ?)
If emulator please check below:
I resolved this issue by creating a new avd with target version as : Google APIs(GoogleInc) API Level 18. (platform 4.3 google api required)