19

I use this method to check the availability of play services:

private boolean checkPlayServices() {
    int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
    if (status != ConnectionResult.SUCCESS) {
        if (GooglePlayServicesUtil.isUserRecoverableError(status)) {
            showErrorDialog(status);
        } else {
            Toast.makeText(this, "This device is not supported.", Toast.LENGTH_LONG).show();
            finish();
        }
        return false;
    }
    return true;
}

status is now set to 2 when I run the app which indicates that the installed play services need an update, even though the play store has no update in store for the play services.

The dialog from the isUserRecoverableError invocation says:

Update Google Play services - This app won't run unless you update Google Play services

This is happening right after I updated my Android SDK through the SDK Manager which updated "Google Repository" (and not, if I recall correctly, "Google Play Services", though that one was updated yesterday without any trouble).

Android Studio tells me that the play services version is 5.2.08.

What can I do? Can I for example force a lower version in the dependencies section?

compile 'com.google.android.gms:play-services:+'
nhaarman
  • 98,571
  • 55
  • 246
  • 278
  • Even though this is related to the emulator and not real devices it might be worth checking this out https://code.google.com/p/android/issues/detail?id=57880 – Tristan Burnside Aug 08 '14 at 07:48
  • Looks like my problem exactly though I can't find any workaround in there –  Aug 08 '14 at 07:58
  • I'm using an HTC One M8 and it's giving me this problem. When I click the Update button, it opens the Google Play services app from the Play Store. However, there's no Update button. – Gerard Aug 10 '14 at 19:26

2 Answers2

24

Originally posted in the question


I specified the previous version I remember seeing in app/build.gradle and my app runs fine now:

compile 'com.google.android.gms:play-services:5.0.89' 
nhaarman
  • 98,571
  • 55
  • 246
  • 278
  • Can you tell where you find the version number for play services? – grandouassou Aug 10 '14 at 19:09
  • 1
    To find the version number take a look in the Android SDK's local maven repository folder. e.g. android-sdk/extras/google/m2repository/com/google/android/gms/play-services – richardleggett Aug 20 '14 at 12:01
  • 1
    Okay so let's say you have to compile the app with this lower version to match the version on the device, why is that? For some reason I cannot update my Galaxy S4 to use a later version than 5.0.89 which is strange – Daniel Wilson Sep 03 '14 at 16:09
  • 1
    This works for me. @DanielWilson the problem is that the version that is in the SDK is newer than the Google send to the devices. I guess in a few days/weeks this problem will be solved when google upgrade Google Play Services – Aracem Sep 08 '14 at 09:59
  • Didn't work for me, still get Google Play services out of date. Requires 5208000 but found 5089038 although specified 5.0.89 Any suggestions? – user2410644 Sep 16 '14 at 16:05
  • I think the Play Services lib 5.2.08 is currently only available for devices running the Android L preview builds. – dst Sep 22 '14 at 09:19
0

Had to fix building using 5.0.89 too because my device won't update the google play services.

Stephen Lynx
  • 1,077
  • 2
  • 14
  • 29