我已经发布了一个包含地图 api (google-play-services) 和 ActionBar Sherlock 的应用程序,并且我在太多设备、多个版本中进行了太多测试。
但是有一个用户用他的设备(Galaxy Ace(GT-S5830B))下载了应用程序(https://play.google.com/store/apps/details?id=br.ufc.ondefica),当他去的时候到抽屉上的“Ver Mapa”(见地图)菜单,他有以下例外:
java.lang.NoSuchMethodError: java.io.IOException.<init>
at com.google.android.gms.internal.g.f(Unknown Source)
at com.google.android.gms.internal.g.b(Unknown Source)
at com.google.android.gms.internal.e.a(Unknown Source)
at com.google.android.gms.internal.e.a(Unknown Source)
at com.google.android.gms.internal.bq.ac(Unknown Source)
at com.google.android.gms.internal.cg$1.run(Unknown Source)
at com.google.android.gms.internal.ch$1.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
at java.lang.Thread.run(Thread.java:1096)
这就是 Google Play 向我展示的一切。因此,我在 Internet 上查找了该错误,并发现此错误可能是由于 Maps 应用程序(但它运行良好,用户说)或者它可能与接收的 IOException 构造函数有关类似 Throwable 的参数(API 级别 9)。我不知道这个错误在哪里,即使它正在与此设备具有相同 API 级别的其他设备上运行。
这是我的 MapFragment 代码:
public class UFCMapFragment extends FragmentWithSearch {
private GoogleMap map;
private int positionToShow = 3;
private boolean isDefaultView = true;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.map_layout, container, false);
((MainActivity) getActivity()).setTitle(getResources().getStringArray(R.array.sliding_menu)[0]);
return root;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
map = ((SupportMapFragment) getActivity().getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
map.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
map.setMyLocationEnabled(true);
Bundle bundle = getArguments();
if (bundle != null && bundle.containsKey("positionToShow")) {
isDefaultView = false;
positionToShow = bundle.getInt("positionToShow");
}
loadMap();
// Move the camera instantly to the default place to show with a zoom of
// 15.
map.moveCamera(CameraUpdateFactory.newLatLngZoom(DataHelper.data.places
.get(positionToShow).getCoordinates(), 13));
// Zoom in, animating the camera.
map.animateCamera(CameraUpdateFactory.zoomTo(16), 4000, null);
}
private void loadMap() {
for (int i = 0; i < DataHelper.data.places.size(); i++) {
Placemark place = DataHelper.data.places.get(i);
Marker marker = map.addMarker(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromResource(ParserKML
.loadMapOfIcons(place.getIconID())))
.title(place.getName()).snippet(place.getDescription())
.position(place.getCoordinates()));
if (i == positionToShow && !isDefaultView)
marker.showInfoWindow();
}
}
public void onDestroyView() {
super.onDestroyView();
Fragment fragment = (getFragmentManager().findFragmentById(R.id.map));
FragmentTransaction ft = getActivity().getSupportFragmentManager()
.beginTransaction();
ft.remove(fragment);
ft.commit();
}
}
提前致谢,