在我开始之前,我已经尝试了在stackoverflow以及其他论坛上发布的类似问题下提供的每个解决方案,但无济于事:
我有下面的代码来渲染地图…它工作了几天,然后完全停止工作。我已经更改了API密钥,但也没有更改。
public class The_Map_Fragment extends SherlockFragment {
..........
..........
if (googleMap == null) {
googleMap = ((SupportMapFragment)getFragmentManager().findFragmentById(R.id.map)).getMap();
googleMap.setMyLocationEnabled(true);
googleMap.getUiSettings().setZoomControlsEnabled(true);
googleMap.getUiSettings().setZoomGesturesEnabled(true);
googleMap.getUiSettings().setMyLocationButtonEnabled(true);
CameraPosition cameraPosition = new CameraPosition.Builder().target(new LatLng(-1.281509, 36.816974)).zoom(13).build();
googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
if (googleMap == null) {
Toast.makeText(getActivity(),"Sorry! unable to Instatntiate Google Maps", Toast.LENGTH_SHORT).show();
}
}
我的xml如下:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
我的清单具有所有引用和权限ok
<permission android:name="com.the.app.rr.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.the.app.rr.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Required to show current location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
当我运行时,我得到错误无法找到类'com.google.android.gms.location.internal.ParcelableGeofence',从方法gls.a引用
对我来说,设置Eclipse的Preferences -> Android -> Build -> Custom keystore解决了这个问题。