Android中的谷歌地图问题

时间:2011-04-21 08:49:07

标签: android google-maps

嗨我制作谷歌地图应用程序,但是当我调用我在其中生成MapActivity后跟错误的类时

AndroidRuntime  FATAL EXCEPTION: main
    ERROR   AndroidRuntime  java.lang.NoClassDefFoundError: org.me.bdn.MapDemo
    936 ERROR   AndroidRuntime      at org.me.bdn.listdata$1.onItemClick(listdata.java:53)
    936 ERROR   AndroidRuntime      at android.widget.AdapterView.performItemClick(AdapterView.java:284)
    936 ERROR   AndroidRuntime      at android.widget.ListView.performItemClick(ListView.java:3382)
14:02:25.856    936 ERROR   AndroidRuntime      at android.widget.AbsListView$PerformClick.run(AbsListView.java:1696)
14:02:25.856    936 ERROR   AndroidRuntime      at android.os.Handler.handleCallback(Handler.java:587)
14:02:25.856    936 ERROR   AndroidRuntime      at android.os.Handler.dispatchMessage(Handler.java:92)
14:02:25.856    936 ERROR   AndroidRuntime      at android.os.Looper.loop(Looper.java:123)
14:02:25.856    936 ERROR   AndroidRuntime      at android.app.ActivityThread.main(ActivityThread.java:4627)
14:02:25.856    936 ERROR   AndroidRuntime      at java.lang.reflect.Method.invokeNative(Native Method)
14:02:25.856    936 ERROR   AndroidRuntime      at java.lang.reflect.Method.invoke(Method.java:521)
14:02:25.856    936 ERROR   AndroidRuntime      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
14:02:25.856    936 ERROR   AndroidRuntime      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
14:02:25.856    936 ERROR   AndroidRuntime      at dalvik.system.NativeStart.main(Native Method)


my MapActivity class is given here

import android.os.Bundle;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

/**
 *
 * @author bhaveshn
 */
public class MapDemo  extends MapActivity{

    @Override
    protected boolean isRouteDisplayed() {
         return false;

    }

    @Override
    protected void onCreate(Bundle vi) {
        super.onCreate(vi);
        setContentView(R.layout.map);
        MapView mapView = (MapView) findViewById(R.id.mapview);
    mapView.setBuiltInZoomControls(true);
    }


}

我已经在清单文件中添加了这个文件

<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="org.me.bdn">
        <uses-permission android:name="android.permission.INTERNET" />   
<application android:icon="@drawable/icon" >
        <activity android:name=".MapDemo" android:label="Map">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>


 <uses-library android:name="com.google.android.maps" />
    </application>

1 个答案:

答案 0 :(得分:2)

您是否已写下此权限

 <uses-permission android:name="android.permission.INTERNET" />

 <uses-library android:name="com.google.android.maps"/>