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
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;
}
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'
}