我在启动 mapActivity 时遇到了这个异常。
GooglePlayServicesUtil:Google Play 服务已过期。需要 8298000 但找到 6599036
和应用程序在以下行崩溃。
final Marker marker = mMap.addMarker(new MarkerOptions().position(location);
注意:应用程序在 4.3 和 5.0.1 版本上运行良好,但在 4.4.2 中遇到此问题。有什么解决办法吗?
谢谢
我在启动 mapActivity 时遇到了这个异常。
GooglePlayServicesUtil:Google Play 服务已过期。需要 8298000 但找到 6599036
和应用程序在以下行崩溃。
final Marker marker = mMap.addMarker(new MarkerOptions().position(location);
注意:应用程序在 4.3 和 5.0.1 版本上运行良好,但在 4.4.2 中遇到此问题。有什么解决办法吗?
谢谢
Google Play 服务已过时。需要 8298000 但找到 6599036
更新包,Tools > Android > SDK Manager
然后检查 Extras 中所有有可用更新的包。
请使用更新版本
dependencies {
compile 'com.google.android.gms:play-services:8.4.0'
// or compile 'com.google.android.gms:play-services-wearable:7.8.0'
}
这是一个运行时错误,当设备没有与您的应用程序编译时使用的至少相同版本的 Google Play 服务时发生。
如果用户没有您的应用所需的最低版本,您的应用中应该有代码提示用户升级 Google Play 服务。旧的,现在已弃用的方法是使用 GooglePlayServicesUtil:
status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (status != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(status)) {
GooglePlayServicesUtil.getErrorDialog(status, this,
100).show();
}
}
新方法是使用新的GoogleApiAvailability类,来自这个答案的代码:
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;
}