Dan
Dan

Reputation: 1

App won't run unless you update Google Play services

I'm fairly new to developing and have my Google Maps API working perfectly, only snag I have is that in my gradle dependencies I have to compile 'com.google.android.gms:play-services:9.+' instead of play-services 10.0.1.

When I use 10.0.1 on my emulator (the android studio emulator, api25), I open my maps activity I just get

com.android.tools.fd.runtime.BootstrapApplication won't run unless you update Google Play services.

I have all the needed packages installed and everything, not sure why, but no issues at all when I use "play-services:9.+".

However, trying to link my app into Firebase, obviously requires me to use 10.0.1. Is there anything I can do to fix both issues?

Upvotes: 0

Views: 1287

Answers (1)

Daniel Nugent
Daniel Nugent

Reputation: 43322

Any device or emulator will need to have at minimum the version of Google Play Services that your app is compiled with. Standard practice is to prompt the user to upgrade if the version of Google Play Services on the device is lower than needed.

Here is the new way to prompt the user to upgrade Google Play Services. Call this checkPlayServices() method when your app is first launched:

public static final int PLAY_SERVICES_RESOLUTION_REQUEST = 999;
GoogleApiAvailability googleAPI;
private boolean checkPlayServices() {
    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;
}

If the device has an older version of Google Play Services, the update prompt will be shown:

enter image description here

Upvotes: 3

Related Questions