How to download older google play services?
Asked Answered
R

4

42

Im going to use android google maps v2 with android emulator/android studio 0.4.0. One of requirements is to put in project google-play-services_lib with version lower/equal to emulator level. My emulator works with api lv 17. The question is, how to download older version of google-play-services_lib than those downloaded by android sdk manager?

Read answered 7/1, 2014 at 21:42 Comment(10)
All Android devices should always have the latest version of Play Services, as they upgrade automatically. Testing with a lower version shouldn't be necessary.Dumpcart
Then If your device were broken or anything you would have no ability to test your program. Actually if you properly set emulator and libraries maps would work too. But it's out of toppic. Just need to know if it is even possible to download other version. Or maybe I have some misunderstanding with this.Read
if your device was broken to the point where you could not get the new google play service then you would not be able to get an update to an app that had a newer version of google play service so that is a moot pointLovelady
I guess my question is, why do you want to download the older APKs?Dumpcart
In fact, per the documentation, you can check if the latest version isn't installed and direct the user to download it. See the documentation here: developer.android.com/google/play-services/setup.html#ensureDumpcart
+1 on the question. Just as @Read posted, I need to run my app on the Android 4.2.2 emulator, which has the 3136130 version of Google Play Services. That means I need the corresponding version of the library project.Harrier
"All Android devices should always have the latest version of Play Services, as they upgrade automatically. " -- Play services is currently 68MB. Upgrading it requires another 68MB to download the upgraded version while the current version is in use. Many older Android devices simply don't have this much storage. Realistically, they will have all stopped upgrading Play Services at the point where it got too big for them to manage.Salable
One reason you might want to install an older library: What if you want your app to work on older devices, e.g. Android 2.3. If you install the latest google-play-services_lib you will need at least Android 6.0 to compile...Husch
For example: (r28) dl-ssl.google.com/android/repository/… will compile on 2.3.1, but (r29) dl-ssl.google.com/android/repository/… will not.Husch
Can you change the accepted answer to this question? Both of the top 2 posters agree. Check the comments of the answers & the update to the accepted answer.Gogh
S
90

I realise that this is an old question, but I had the same problem today (for real devices not for the emulator) and have found a solution.

I know that you can add code to prompt the user to upgrade to the latest version (see the comment by @nathan-walters) but, for complicated reasons, in my case I need to work with whatever version the user already has installed on their device (if any) and hence prefer to compile/build with an older version of the client library (google-play-services_lib)

So researching further, I unpacked the xml that Android SDK Manager uses to find and install the 'extras' packages including the latest version of Google Play Services.
If you are interested start here: https://dl-ssl.google.com/android/repository/addon.xml

For the current version (as of Nov 10th 2014) that gives you the library for google-play-services_lib at:

https://dl-ssl.google.com/android/repository/google_play_services_6171000_r21.zip

The older versions are in the same location on the google servers (although they could disappear at any time), so if you are prepared to move the current installed library aside and manually unpack an older zip then you can install an old version. I found the following:

The same technique would allow you to test against the non-upgradable older versions Google Maps (Google Play Services) hardwired in older versions of the emulator. I haven't tested all these versions against the emulator but have successfully tested Google Maps in the emulator for an AVD based on Google APIs (API 19).

Google does make the occasional attempt to bring the emulator up to date. Here is an issue tracker thread discussing version incompatibility issues between the client library and the emulator and google's various attempts to fix them: https://code.google.com/p/android/issues/detail?id=57880

[UPDATE:]

@btrue see answer below now has a much better answer than my answer

go to:

<your path to android sdk>/extras/google/m2repository/com/google/android/gms/play-services/

where you will find directories containing the old releases in AAR format - just rename to .zip for extraction.

Syriac answered 10/11, 2014 at 6:51 Comment(6)
That's awesome. I assume the same technique can be used to download older versions of the support library? The SDK Manager only shows the latest version. How did you find the previous file names?Tabbi
@Tabbi - Finding the official version number (i.e. 4132530) for each previous file name is hit & miss - I found these previous file names by scanning various web pages / google searches talking about each release. Hence the gaps where I didn't search that hard.Syriac
That's what I thought. Thanks! Any pointers how to get the support library?Tabbi
@Tabbi - Looking at the contents of addon.xml as described above shows that the support library has a much simpler naming scheme: dl-ssl.google.com/android/repository/support_r21.0.2.zip So just try looking for the version you want.Syriac
Thanks, I tried that. Unfortunately it looks like Google removed the older versions as I am getting 404s.Tabbi
@Tabbi - I'm not sure what version you are looking for, but I just tried an old version for r19 (dl-ssl.google.com/android/repository/support_r19.0.1.zip) which worked for me. My first try was dl-ssl.google.com/android/repository/support_r19.0.0.zip but that didn't exist.Syriac
G
15

The accepted answer is too much trouble. Google actually does distribute old versions in the SDK manager.
Under "Extras", there is "Google Repository".
In the repository is GPS libs going back to version 3.1.36.
They are in AAR format, which is just a zip of the build project.
Change the name to *.zip, unzip it, inside is a classes.jar, which is the jar of all the gps classes.
If you don't need any of the resources, you can add the jar file to your classpath. Done.

ls -l /Applications/Programming/adt-bundle-mac-x86_64-20140702/sdk/extras/google/m2repository/com/google/android/gms/play-services/
total 24
drwxr-xr-x+  8 Norrin  staff  272 Jan 13 01:08 3.1.36
drwxr-xr-x+  8 Norrin  staff  272 Jan 13 01:08 3.1.59
drwxr-xr-x+  8 Norrin  staff  272 Jan 13 01:08 3.2.25
drwxr-xr-x+  8 Norrin  staff  272 Jan 13 01:08 3.2.65
drwxr-xr-x+ 11 Norrin  staff  374 Feb 10 20:09 4.0.30
drwxr-xr-x+  8 Norrin  staff  272 Jan 13 01:08 4.1.32
drwxr-xr-x+  8 Norrin  staff  272 Jan 13 01:08 4.2.42
drwxr-xr-x+  8 Norrin  staff  272 Jan 13 01:08 4.3.23
drwxr-xr-x+  8 Norrin  staff  272 Jan 13 01:08 4.4.52
drwxr-xr-x+  8 Norrin  staff  272 Jan 13 01:08 5.0.89
drwxr-xr-x+  8 Norrin  staff  272 Jan 13 01:08 6.1.11
drwxr-xr-x+  8 Norrin  staff  272 Jan 13 01:08 6.1.71
drwxr-xr-x+  8 Norrin  staff  272 Feb  4 13:43 6.5.87
-rw-r--r--+  1 Norrin  staff  703 Jan 13 01:08 maven-metadata.xml
-rw-r--r--+  1 Norrin  staff   32 Jan 13 01:08 maven-metadata.xml.md5
-rw-r--r--+  1 Norrin  staff   40 Jan 13 01:08 maven-metadata.xml.sha1
Gogh answered 11/2, 2015 at 17:12 Comment(4)
We can use unzip command, unzip aar_file_name.aar -d unzip_folder_nameBoyt
Hi..Am trying to follow your step but when I unzip it I only see AndroidManifest.xml and R.txt.. I don't see any classes.jarFoxtrot
@Foxtrot You need to unzip each individual "sub module" which you use from google play services. E.g. play-services-location/10.0.1/play-services-location-10.0.1.aar for location services.Jell
What about xml files? Without the correct ones for your version of .jar you get inflate errors.Bag
L
1

you can download google play services for froyo in the SDK Manager which works with SDK 8 and up but to get a specific version is not possible AFAIK. The current google play service works with 10 and up

Lovelady answered 7/1, 2014 at 21:45 Comment(4)
But then I need to use support library what I would like to avoid.Read
why do you need to use the support library? google play service does not require the support libraryLovelady
One doesn't need the support library to use the Froyo version of the Google Play Services library. However it doesn't solve the problem: the emulator image has version 3136130, but the Froyo library requires version 3265100.Harrier
You should be testing on an actual device anyway. Emulator testing is not a good solutionLovelady
P
1

One of requirements is to put in project google-play-services_lib with version lower/equal to emulator level.

google-play-services_lib has nothing to do with emulator versions.

The question is, how to download older version of google-play-services_lib than those downloaded by android sdk manager?

AFAIK, there is no way to do this. Furthermore, as has been pointed out, this is not necessary.

Then If your device were broken or anything you would have no ability to test your program

That makes no sense whatsoever. google-play-services_lib is a library. It is not Google Play Services itself, but a client library for utilizing Google Play Services.

But then I need to use support library what I would like to avoid

As has been noted, the Android Support package is not tied to the Play Services SDK. Parts of the Play Services SDK can use the Android Support package (e.g., SupportMapFragment), but the Play Services SDK does not require the Android Support package.

Parthenopaeus answered 7/1, 2014 at 22:15 Comment(7)
There are two reasons why one may want an older version of the Google Play Services SDK: for comprehensive app testing, and because the emulator images for Android 4.2.2 have an older version (3136130) and are not upgradable.Harrier
@JayLieske: You are referring to Google Play Services, not the Google Play Services SDK (i.e., google-play-services_lib).Parthenopaeus
No, I need the older SDK (library project) so that my app doesn't fail with this error at launch: Google Play services out of date. Requires 4030500 but found 3136130Harrier
@JayLieske: You will have to test on Play Services-compatible hardware, then, until such time (if ever) an updated emulator image is available. Google doesn't ship an older Play Services SDK, so unless you can find one on a pirate site (and trust that it has not been tampered with, etc.), you need to use a device that is able to get the latest Play Services.Parthenopaeus
It is in Google's interest to have developers do the dirty work of nagging their users to upgrade the library. It is in developers' interest to use the oldest possible version in order to avoid bugging the user about upgrading the library. Someone should maintain a repo of older libraries.Tengler
Looks like the GPS on the SDK manager right now is way too new, it just crashes and I can't update in the play store on my phone. So nope, it is needed.Octavo
@Parthenopaeus used github.com/commonsguy/cw-omnibus/tree/… and trying GCM notifies..works well if i download latest GPS i.e 8.1. Device has inbuild GPS apk version 6599000(6.5.9.9).why is failing in 6.5.9.9.GPS lib version refered was 7571000.If i make it to 6599000 i get need 7571000 result out dated GPS.Roble

© 2022 - 2024 — McMap. All rights reserved.