4

I'm in the process of switching over to Android Studio from Eclipse. Adding GPServices to my project was pretty straight forward in Eclipse. Just make sure the latest SDK was installed in the SDK manager and copy the library into my workspace from the SDK bundle.

With AS, I have to type the following line into my module build.gradle:

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

How am I supposed to know that 6.5.87 is the right version? My SDK manager says I have Google Play Services Rev. 22. 22 looks different from 6.5.87.

I got the 6.5.87 from some docs that didn't explain what it meant.

Can someone shed any light to this issue?

Adam Stelmaszczyk
  • 19,665
  • 4
  • 70
  • 110
Dean Blakely
  • 3,535
  • 11
  • 51
  • 83
  • How to know the right version? Answer is for any library go to http://gradleplease.appspot.com/ and the library name(play-services). – Psypher Feb 15 '15 at 20:17

2 Answers2

5

In Android Studio, you need to download the Google Repository from the SDK Manager to get the equivalent of Google Play Services in Eclipse. And check YOUR_ANDROID_SDK_PATH\extras\google\m2repository\com\google\android\gms\play-se‌​rvices and you will be able see which versions you can use.

Yash Sampat
  • 30,051
  • 12
  • 94
  • 120
  • thanks for answering. SDK for google repository is rev. 15 and is installed. 6.5.87 is the highest numbered directory under Play-services. The only thing I have done is put that compile line under dependencies in the module build.gradle. Do I need to do anything else? – Dean Blakely Feb 15 '15 at 22:06
4

Instead of guessing the which version to add to build.gradle, or checking http://gradleplease.appspot.com (I found this web site to be out of date), do the following:

  1. Go to File -> Project Structure -> app -> Dependencies tab.
  2. Click '+' -> Library Dependencies
  3. Search for com.google.android.gms
  4. Select com.google.android.gms:play-services:CurrentVersion
  5. Click OK.
  6. Click OK for Project Structure window.
joshgoldeneagle
  • 4,616
  • 2
  • 23
  • 30