Java 新谷歌安卓地图上的应用程序崩溃

Java 新谷歌安卓地图上的应用程序崩溃,java,android,google-maps,Java,Android,Google Maps,我添加了googlemapsv2。他们使用googleplay服务。从评分来看,大多数用户没有更新Google play服务,因此在尝试打开应用程序时会崩溃 有没有办法让我们的部分代码成为google play服务的库,这样他们就不会崩溃 如果用户没有Google play服务您可以通过显示对话框来获取它,您很乐意找到任何解决方案 // Getting Google Play availability status int status = GooglePlayServicesUtil.isGo

我添加了
googlemapsv2
。他们使用
googleplay服务
。从评分来看,大多数用户没有更新Google play服务,因此在尝试打开应用程序时会崩溃

有没有办法让我们的部分代码成为google play服务的库,这样他们就不会崩溃


如果用户没有
Google play服务

您可以通过显示对话框来获取它,您很乐意找到任何解决方案

// Getting Google Play availability status
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity());


//there are other "status" values as well, you can check according to your need

// Showing status
if(status!=ConnectionResult.SUCCESS){ // Google Play Services are not available

    int requestCode = 10;
    ialog dialog = GooglePlayServicesUtil.getErrorDialog(status, getActivity(), requestCode);
    dialog.show();

}else{ // Google Play Services are available 

    // get map and play with it
}
其中,
ConnectionResult
为:

import com.google.android.gms.common.ConnectionResult;

如果用户没有
googleplay服务
,您可以显示对话框获取它

// Getting Google Play availability status
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity());


//there are other "status" values as well, you can check according to your need

// Showing status
if(status!=ConnectionResult.SUCCESS){ // Google Play Services are not available

    int requestCode = 10;
    ialog dialog = GooglePlayServicesUtil.getErrorDialog(status, getActivity(), requestCode);
    dialog.show();

}else{ // Google Play Services are available 

    // get map and play with it
}
其中,
ConnectionResult
为:

import com.google.android.gms.common.ConnectionResult;
验证此设备上是否安装并启用了Google Play services,以及此设备上安装的版本是否不早于此客户端所需的版本

返回 指示是否存在错误的状态代码。在ConnectionResult中可以是以下内容之一:成功、缺少服务、需要服务版本更新、禁用服务、无效服务

查看主题下的开发者网站,查看Google Play服务

验证此设备上是否安装并启用了Google Play services,以及此设备上安装的版本是否不早于此客户端所需的版本

返回 指示是否存在错误的状态代码。在ConnectionResult中可以是以下内容之一:成功、缺少服务、需要服务版本更新、禁用服务、无效服务

查看主题下的开发者网站,查看Google Play服务


您如何在图书馆项目中引用google play服务?你能解释一下吗detail@Raghunandan属性>Android>添加Library获得的播放服务。现在你面临的问题是什么?有任何异常或错误吗?看看那些没有更新google play服务的人是否在mMap=((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.mapView)).getMap()崩溃;很可能是classDef未找到错误。我现在不记得了。你会在模拟器上遇到同样的错误。你是如何在你的图书馆项目中引用google play服务的?你能解释一下吗detail@Raghunandan属性>Android>添加Library获得的播放服务。现在你面临的问题是什么?有任何异常或错误吗?看看那些没有更新google play服务的人是否在mMap=((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.mapView)).getMap()崩溃;很可能是classDef未找到错误。我现在不记得了。你在模拟器上也会遇到同样的错误。这很酷,但我们有没有办法添加lib类的东西,使其自动支持我的地图?@MuhammadUmar检查我答案中的链接。@MuhammadUmar如果你已经将adt更新为rev 22,请检查此链接@MuhammadUmar是否已经将你的adt插件更新为rev 22。我怀疑是这样的,这是导致classdef not found Error的原因。这是一件很酷的事情,但我们有没有办法添加lib类的东西,使其自动支持我的地图?@MuhammadUmar检查我答案中的链接。@MuhammadUmar如果您已将adt更新为rev 22,请检查此链接@MuhammadUmar是否已将adt插件更新为rev22我怀疑是这种情况,这是导致classdef not found错误的原因