尝试在模拟器或设备上运行地图视图时,活动崩溃。我觉得这可能是由于所需库的导入问题。该错误将显示类未找到异常。如果您需要更多信息,请告诉我。我也一直在关注本教程:https ://blog-emildesign.rhcloud.com/?p=435
活动:
package com.klinetel.countydentistfinder;
import com.google.android.gms.maps.*;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
public class ClinicMapActivity extends FragmentActivity
{
MapView m;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_clinic_map);
}
}
活动布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<fragment
android:name="com.google.android.gms.maps.SupportMapFragment"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
显现:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.klinetel.countydentistfinder"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="com.klinetel.countydentistfinder.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<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"/>
<permission
android:name="com.klinetel.countydentistfinder.LocationGoogleMapV2Demo.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<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.klinetel.countydentistfinder.MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.klinetel.countydentistfinder.ClinicListingActivity"
android:label="@string/title_activity_clinic_listing"
android:parentActivityName="com.klinetel.countydentistfinder.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.klinetel.countydentistfinder.MainActivity" />
</activity>
<activity
android:name="com.klinetel.countydentistfinder.ClinicMapActivity"
android:label="@string/title_activity_clinic_map"
android:parentActivityName="com.klinetel.countydentistfinder.ClinicListingActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.klinetel.countydentistfinder.MainActivity" />
</activity>
<uses-library android:name="com.google.android.maps"></uses-library>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value=""/>
</application>
</manifest>
日志猫: