我一直在从这里学习谷歌地图 api ,并按照所说的做了。我的mainactivity
代码如下:
package com.map.place;
import android.app.Activity;
import android.os.Bundle;
import com.google.android.maps.MapActivity;
public class MainActivity extends MapActivity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
}
main.xml
如下:
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="0Ove92B2I7FZi4SR2YX89jA374Wcg6-cJ33VwUg"
/>
最后manifest
文件如下:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.map.place"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="10" />
<application android:label="@string/app_name" >
<activity android:name="MainActivity"
android:label="@string/app_name">
<uses-library android:name="com.google.android.maps" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
logcat 控制台显示如下:
E/AndroidRuntime( 975): FATAL EXCEPTION: main
E/AndroidRuntime( 975): java.lang.RuntimeException: Unable to instantiate activ
ity ComponentInfo{com.map.place/com.map.place.MainActivity}: java.lang.ClassNotF
oundException: com.map.place.MainActivity in loader dalvik.system.PathClassLoade
r[/data/app/com.map.place-2.apk]
我不知道出了什么问题,但这是显示Sorry, the app stopped unexpectedly
. avd
我在2.3.3
平台和 API 级别上运行它10
。请纠正我...