简体   繁体   中英

Google Play Service Version

im using Google Play Services. I tried to use a Nexus 7 emulator to run my project, In the log I found this:

GooglePlayServicesUtil( 1536): Google Play services out of date. Requires 6171000 but found 5053030.

Now im wondering if I want my application to work properly with the Google Play Services on older devices, do I need to compile an older version of the library?

So how does that version thing work exactly?

Thanks for your answer !

Google Play Services is supported on Android 2.3.3 and above.

That output you see is telling you that your application requires Google Play Services v6.1.71. You probably have this in your build.gradle file:

compile 'com.google.android.gms:play-services:6.1.71' // or 6.1.+

The second part of the output "but found 5053030" means your device has the Google Play Services app which is lower than what is required of your application. The Google Play Services app eventually will automatically update on your device.

You can use this code snippet in your application that will show a dialog an allow the user to try and update their version of the Google Play Services app installed on their device.

/**
 * Check the device to make sure it has the Google Play Services APK. If
 * it doesn't, display a dialog that allows users to download the APK from
 * the Google Play Store or enable it in the device's system settings.
 */
public static boolean checkGooglePlayServices(Activity activity) {
    int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(activity);
    if (resultCode != ConnectionResult.SUCCESS) {
        if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
            GooglePlayServicesUtil.getErrorDialog(resultCode, activity, 9000).show();
        }
        return false;
    }
    return true;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM