在运行谷歌地图v2时遇到致命异常,我确实导入了google-play-service-lib 并从谷歌制作Api,主要节目使用:
<?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" />
这是课堂活动:
package 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,
答案 0 :(得分:-1)
尝试不同的代码
链接:http://www.vogella.com/articles/AndroidGoogleMaps/article.html
这里完全描述了关于googlemap的一件事,你总是记得你的googlemap无法在模拟器上显示它将在真实设备上运行但你应该首先在模拟器上测试它,如果没有错误发生,那么在真实手机上测试它。