试图在android中显示一个简单的谷歌地图..我怎么能这样做?

时间:2015-11-02 07:35:46

标签: android google-maps

我正在尝试在android中显示一个简单的谷歌地图。每当我运行我的应用程序,得到,不幸的是googlemap已停止在模拟器上。我添加了google_play_service_lib并在我的项目中引用它。我仍然得到同样的东西。  我能做些什么才能解决这个问题? TIA。

  1. 列表项
  2. 这是我的MainActivity类:

    public class MainActivity extends MapActivity {
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
    
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
    
        }
    
        protected boolean isRouteDisplayed(){
    
              return false;
    
        }
    }
    
    1. xml文件是:
    2. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="match_parent"
          android:layout_height="fill_parent">
      
      <fragment
          android:id="@+id/map"
          android:name="com.google.android.gms.maps.MapFragment"
          android:layout_width="match_parent"
          android:layout_height="match_parent" />
      

      This is the error what I am getting in logcat.

       Manifest file...
      <uses-sdk
          android:minSdkVersion="8"
          android:targetSdkVersion="21" /> 
      <permission
        android:name="com.example.googlemaps.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />
          < ACCESS_NETWORK_STATE,WRITE_EXTERNAL_STORAGE,INTERNET,
           ACCESS_COARSE_LOCATION,ACCESS_FINE_LOCATION,READ_GSERVICE
             These all permission I have added>
       <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.googlemap.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>
          <meta-data
           android:name="com.google.android.maps.v2.API_KEY"
           android:value="APIkey" />
          <meta-data
              android:name="com.google.android.gms.version"
              android:value="@integer/google_play_services_version" />
       </application>
         </manifest>
      

0 个答案:

没有答案