2

I am getting this exception while starting the mapActivity.

GooglePlayServicesUtil: Google Play services out of date. Requires 8298000 but found 6599036

and App Crashes at following line.

final Marker marker = mMap.addMarker(new MarkerOptions().position(location);

Note: App is working fine on 4.3 and 5.0.1 version but facing this problem in 4.4.2. Any solution?

Thanks

Usman Ishrat
  • 147
  • 1
  • 7

2 Answers2

1

Google Play services out of date. Requires 8298000 but found 6599036

Update packages in Tools > Android > SDK Manager and then check all the packages in Extras that have an update available.

Please use updated version

dependencies {
        compile 'com.google.android.gms:play-services:8.4.0'
        // or compile 'com.google.android.gms:play-services-wearable:7.8.0'
    }
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
  • 1
    ## steps to add dependency ## It will automatically takes latest version 1. Go to **File menu > Project structure** 2. Select app from left panel 3. Select **Dependencies** tab 4. Click on **+** sign button 5. Select **Library Dependency** 6. Select **google play service** (you can add other services if required) 7. OK – Shaktisinh Jadeja Feb 02 '16 at 08:51
  • 1
    To fix this using a project configuration, the OP would actually need to go the other direction and compile their app with Google Play Services 6.5 or older. See here: http://stackoverflow.com/questions/19721415/google-play-services-out-of-date-requires-4030500-but-found-3266132 – Daniel Nugent Feb 02 '16 at 08:53
0

This is a runtime error that occurs when the device does not have at least the same version of Google Play Services that your app is compiled with.

You should have code in your app that prompts the user to upgrade Google Play Services if they don't have the minimum version required by your app. The old, now deprecated way was to use GooglePlayServicesUtil:

status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (status != ConnectionResult.SUCCESS) {
    if (GooglePlayServicesUtil.isUserRecoverableError(status)) {
        GooglePlayServicesUtil.getErrorDialog(status, this,
                100).show();
    } 
}

The new way is to use the new GoogleApiAvailability class, code from this answer:

private boolean checkPlayServices() {
    GoogleApiAvailability googleAPI = GoogleApiAvailability.getInstance();
    int result = googleAPI.isGooglePlayServicesAvailable(this);
    if(result != ConnectionResult.SUCCESS) {
        if(googleAPI.isUserResolvableError(result)) {
            googleAPI.getErrorDialog(this, result,
                    PLAY_SERVICES_RESOLUTION_REQUEST).show();
        }

        return false;
    }

    return true;
}
Community
  • 1
  • 1
Daniel Nugent
  • 43,104
  • 15
  • 109
  • 137
  • Thanks a lot. 1st option helped me and i hope that 2nd option is also good, can you please tell that what should be the value for PLAY_SERVICES_RESOLUTION_REQUEST? (should I use any of my choice?) – Usman Ishrat Feb 02 '16 at 09:05
  • Ahh, yes that is just an int constant, your choice. You can just use 100 like the first example as well. – Daniel Nugent Feb 02 '16 at 09:17