15

I am migrating from Eclipse to Android Studio. I have a project that I imported into Android Studio that uses Google Play Services, so I am following the documentation I found here: http://developer.android.com/google/play-services/setup.html This documentation says that I need to edit my build.gradle file. They give the example:

apply plugin: 'com.android.application'
...

dependencies {
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'com.google.android.gms:play-services:6.5.87'
}

Also the documentation mentions, "Be sure you update this version number each time Google Play services is updated.", which I assume is 6.5.87 in the above example. So how do I determine the "version" Google Play Services I have installed with my Android SDK manager. Here is a screen shot of my android sdk:

enter image description here

So my Android SDK Manager tells me I have installed "Revision" so what do I put in my build.gradle file?

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

... or maybe ...

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

Any help appreciated!

UPDATE: Thank you for all your answers.

I was able to find the version like so:

Leila001@win8 ~/Windows_Home/AppData/Local/Android/android-sdk/extras/google/google_play_services/libproject/google-play-services_lib/res/values
$ cat version.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <integer name="google_play_services_version">6587000</integer>
</resources>
Red Cricket
  • 9,762
  • 21
  • 81
  • 166
  • 6.5.87 is the newest version as of 2/13/2015. you can look here for the recent ones https://developer.android.com/google/play-services/index.html – tyczj Feb 14 '15 at 03:45

2 Answers2

20

You have the right idea by checking to make sure you do not have any updates.

The easiest way to check is simply when you have the latest downloaded in the Android SDK(locally).

I am using Mac OSX:

~/android-sdk/extras/google/m2repository/com/google/android/gms/play-services/

If you look where you have YOUR-ANDROID-SDK/extras/google/m2repository/com/google/android/gms/play-services/, you will see all the versions downloaded that you have.

The latest one being 6.5.87. (compile 'com.google.android.gms:play-services:6.5.87')

For you, the directory path on Windows would be:

C:\Users\Leila001\AppData\Local\Android\extras\google\m2repository\com\google\android\gms\play-services
Jared Burrows
  • 54,294
  • 25
  • 151
  • 185
  • 2
    This is the closest answer so far. Actually I found the version here: c:\Users\Leila001\AppData\Local\Android\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib\res\values\version.xml – Red Cricket Feb 14 '15 at 04:45
  • Yes! That is in there as well. That is why I left the "gms/play-services/" folder at a higher level. Basically Google has you download the .jars through the SDK manager and you bring them in locally. – Jared Burrows Feb 14 '15 at 04:46
  • Thank you sooooo much! I really wanted to know about the all version names! – cmcromance Nov 05 '15 at 10:02
  • 1
    And one more thing! We can get the release note of all versions! Here! https://developers.google.com/android/guides/releases – cmcromance Nov 05 '15 at 10:04
  • @RedCricket I went to the path you said but it has information like 8487000 . so what is the version like 6.5.87 ? I want to add this google-play service library in gradle – Programmer Apr 04 '16 at 03:52
  • @Programmer `6.5.87` is an older version. Use the latest `8.4.0`. Use one of the modules such as `play-services-analytics`. – Jared Burrows Apr 04 '16 at 04:33
3

You can see which version you have in project structure - dependecies - click on plus in right cornner - libary dependencies

and just add it to build.gradle with click or manually:

 compile 'com.google.android.gms:play-services:6.5.87'
Djordje Tankosic
  • 1,975
  • 2
  • 20
  • 21