我在运行 google map v2 时面临一个致命异常,我确实导入了 google-play-service-lib 并从 google 制作了一个 Api,并且 mainfest 正在使用:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.getlocation"
android:versionCode="1"
android:versionName="1.0" >
<permission
android:name="com.example.getLocation.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.example.getlocation.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<!-- The following two permissions are not required to use
Google Maps Android API v2, but are recommended. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.getlocation.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.example.getlocation.map"
android:screenOrientation="portrait"
></activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyB7rXLp7f3cnZ0sdjqQnCQiPbiPpkNVmPc"/>
</application>
</manifest>
地图布局xml是:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="@+id/the_map"
android:name="com.google.android.gms.maps.SupportMapFragment "
android:layout_width="match_parent"
android:layout_height="match_parent" />
这是课堂活动:
包 com.example.getlocation;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
public class map extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
}
}
并且手机运行的版本是 2.3.6 ,