2014-11-06 133 views
1

即时通讯使用Google Play服务。 我试图用一台Nexus 7模拟器来运行我的项目,在日志中,我发现这一点:Google Play服务版本

GooglePlayServicesUtil(1536):谷歌Play服务过时。需要6171000但发现5053030.

现在我想知道如果我想我的应用程序,以旧设备上与谷歌Play服务的正常工作,我需要编译库的旧版本?

那么这个版本的东西究竟是如何工作的?

感谢您的回答!

+0

你想支持哪个版本的android? – tyczj 2014-11-06 21:03:02

回答

1

Android 2.3.3及更高版本支持Google Play服务。

您看到的输出是告诉您您的应用程序需要Google Play Services v6.1.71。你可能有这样的在你的build.gradle文件:

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

输出的第二部分“但发现5053030”是指您的设备的谷歌Play服务的应用程序,它比什么是需要你的应用程序的低。 Google Play服务应用最终会在您的设备上自动更新。

您可以在您的应用程序中使用此代码段,该代码段将显示一个对话框,允许用户尝试更新其设备上安装的Google Play服务应用程序的版本。

/** 
* 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; 
} 
相关问题