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?

10
  • 1
    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. Jan 7, 2014 at 21:47
  • 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.
    – Jacob
    Jan 7, 2014 at 21:52
  • 1
    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 point
    – tyczj
    Jan 7, 2014 at 21:55
  • I guess my question is, why do you want to download the older APKs? Jan 7, 2014 at 21:56
  • 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#ensure Jan 7, 2014 at 22:00

4 Answers 4

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.

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? Nov 17, 2014 at 9:27
  • @friederbluemle - 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.
    – Mike
    Nov 18, 2014 at 3:02
  • That's what I thought. Thanks! Any pointers how to get the support library? Nov 19, 2014 at 19:11
  • @friederbluemle - 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.
    – Mike
    Nov 19, 2014 at 23:50
  • Thanks, I tried that. Unfortunately it looks like Google removed the older versions as I am getting 404s. Dec 1, 2014 at 8:37
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
4
  • We can use unzip command, unzip aar_file_name.aar -d unzip_folder_name
    – Nhat Dinh
    Nov 2, 2015 at 2:29
  • 5
    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.jar
    – Karthik
    Jun 29, 2016 at 22:52
  • 1
    @Karthik 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.
    – Pellet
    Feb 13, 2017 at 6:18
  • What about xml files? Without the correct ones for your version of .jar you get inflate errors.
    – Thracian
    Mar 12, 2017 at 11:38
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

4
  • But then I need to use support library what I would like to avoid.
    – Jacob
    Jan 7, 2014 at 21:46
  • 2
    why do you need to use the support library? google play service does not require the support library
    – tyczj
    Jan 7, 2014 at 21:46
  • 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.
    – Jay Lieske
    Jan 31, 2014 at 0:52
  • You should be testing on an actual device anyway. Emulator testing is not a good solution
    – tyczj
    Jan 31, 2014 at 1:02
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.

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.
    – Jay Lieske
    Jan 31, 2014 at 0:21
  • @JayLieske: You are referring to Google Play Services, not the Google Play Services SDK (i.e., google-play-services_lib). Jan 31, 2014 at 0:24
  • 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 3136130
    – Jay Lieske
    Jan 31, 2014 at 0:41
  • @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. Jan 31, 2014 at 0:49
  • 3
    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.
    – miguel
    Aug 6, 2014 at 20:16

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.