我完成了添加谷歌地图 api 的程序,但我收到了这个错误。对不起语言不好。
09 12:20:55.359: W/dalvikvm(5918): Unable to resolve superclass of Lmaps/a/du; (406)
01-09 12:20:55.359: W/dalvikvm(5918): Link of class 'Lmaps/a/du;' failed
01-09 12:20:55.359: W/dalvikvm(5918): Unable to resolve superclass of Lmaps/a/ej; (2358)
01-09 12:20:55.359: W/dalvikvm(5918): Link of class 'Lmaps/a/ej;' failed
01-09 12:20:55.359: W/dalvikvm(5918): Unable to resolve superclass of Lmaps/j/k; (2374)
01-09 12:20:55.359: W/dalvikvm(5918): Link of class 'Lmaps/j/k;' failed
01-09 12:20:55.359: E/dalvikvm(5918): Could not find class 'maps.j.k', referenced from method maps.y.ae.a
01-09 12:20:55.359: W/dalvikvm(5918): VFY: unable to resolve new-instance 3566 (Lmaps/j/k;) in Lmaps/y/ae;
这里是 manifest.xml
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="com.comparto.piso.permission.MAPS_RECEIVE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<permission
android:name="com.comparto.piso.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<application
........ >
<uses-library android:name="com.google.android.maps" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="api key" />
......
.....
在java代码中我扩展了FragmentActivity,这里是onCreate代码
GooglePlayServicesUtil
.isGooglePlayServicesAvailable(getApplicationContext());
GoogleMap map = ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
if (map != null) {
map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
}
这里是布局 xml
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="300px"
class="com.google.android.gms.maps.SupportMapFragment" />