【问题标题】:Google Play Service Version谷歌播放服务版本
【发布时间】:2014-11-07 06:09:59
【问题描述】:
我正在使用 Google Play 服务。
我尝试使用 Nexus 7 模拟器来运行我的项目,在日志中我发现:
GooglePlayServicesUtil(1536):Google Play 服务已过期。需要 6171000 但找到 5053030。
现在我想知道我是否希望我的应用程序在旧设备上与 Google Play 服务一起正常工作,我是否需要编译旧版本的库?
那么那个版本的东西到底是如何工作的呢?
感谢您的回答!
【问题讨论】:
标签:
android
emulation
google-play-services
【解决方案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.+
输出的第二部分“but found 5053030”表示您的设备具有的 Google Play 服务应用低于您的应用所需的应用。 Google Play 服务应用最终会在您的设备上自动更新。
您可以在您的应用程序中使用此代码 sn-p,该代码将显示一个对话框,允许用户尝试更新其设备上安装的 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;
}