How can I determine the version of Google Play ser

2020-06-01 06:55发布

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>

2条回答
家丑人穷心不美
2楼-- · 2020-06-01 07:19

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'
查看更多
老娘就宠你
3楼-- · 2020-06-01 07:23

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
查看更多
登录 后发表回答