EnduroDave
EnduroDave

Reputation: 1033

Gradle build fails looking for Google Play Services in Android Studio - is my SDK correct?

I have a question very similar to Gradle build fails looking for Google Play Services in Android Studio

I have a working android project but when I add

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

I get a gradle build error

Error:Failed to find: com.google.android.gms:play-services:5.2.8
<a href="openFile">Open File</a><br><a href="open.dependency.in.project.structure">Open in Project Structure dialog</a>

I have added the SDKs through the manager. Other threads have suggested that there might be a second SDK library on the computer causing the issue, but I have not been able to resolve this. I am using a mac (and normally a PC user so please bear with me) and looking at the SDK manager and the project structure dialog both say the SDK is located at:

/Applications/Android Studio.app/sdk

Given they are pointing to the same place it must be some other cause of the error?

Maybe I have a version other than 5.2.8 (although unlikely, as andoid studio says this is the most up to date and I have just updated the SDK)? How can I check the version installed on my machine - its not in the file names?

Upvotes: 5

Views: 7243

Answers (4)

olleh
olleh

Reputation: 2093

I had a different problem altogether. I'd put the line

apply plugin: 'com.google.gms.google-services'

at the start of the file. Even before:

apply plugin: 'com.android.application'

And had to scratch my head for half an hour.

So the final (working) condition looked like:

apply plugin: 'com.android.application'

apply plugin: 'com.google.gms.google-services'

Upvotes: 0

Pratik Mandrekar
Pratik Mandrekar

Reputation: 9566

There is a problem with the 5.0.77 release version. Change com.google.android.gms:play-services:5.0.77 to com.google.android.gms:play-services:5.0.89 and things will work fine.

Google pulled out 5.0.77 from the Maven repository due to some critical bugs. Read More.

Upvotes: 5

Jc Mi&#241;arro
Jc Mi&#241;arro

Reputation: 1411

If you are going to use version 5.2.8 you have to set on your build.gradle

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

Because it is store on the directory :

ANDROID_SDK_PATH/extras/google/m2repository/com/google/android/gms/play-services/5.2.08

You can use '+' instead '08' and you will be using the last minor version

compile 'com.google.android.gms:play-services:5.2.+'

Upvotes: 7

EnduroDave
EnduroDave

Reputation: 1033

OK so it looks as though my version number was off and thats all that was causing the problem. If anyone else has this issue check your version number in the AndroidManifest.xml file in the google_play_services_lib directory

Upvotes: 5

Related Questions