2012-06-13 63 views
1

我有一個谷歌地圖的問題。當我開始擴展MapActivity的新活動時,我得到了NoClassDefFoundError。我已經建立目標設置爲2.2谷歌API和谷歌地圖android 2.2 NoClassDefFoundError

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

<application>裏面的定義標籤。我也有mapsApiKey和所有我需要使它的工作,但它不。

日誌

06-13 15:05:43.276: E/AndroidRuntime(19350): FATAL EXCEPTION: main 
06-13 15:05:43.276: E/AndroidRuntime(19350): java.lang.NoClassDefFoundError: pl.mm.dt.AddPlaceActivity 
06-13 15:05:43.276: E/AndroidRuntime(19350): at pl.mm.dt.NewNormalNoteActivity$2.onClick(NewNormalNoteActivity.java:67) 
06-13 15:05:43.276: E/AndroidRuntime(19350): at android.view.View.performClick(View.java:2495) 
06-13 15:05:43.276: E/AndroidRuntime(19350): at android.view.View$PerformClick.run(View.java:9100) 
06-13 15:05:43.276: E/AndroidRuntime(19350): at android.os.Handler.handleCallback(Handler.java:587) 
06-13 15:05:43.276: E/AndroidRuntime(19350): at android.os.Handler.dispatchMessage(Handler.java:92) 
06-13 15:05:43.276: E/AndroidRuntime(19350): at android.os.Looper.loop(Looper.java:130) 
06-13 15:05:43.276: E/AndroidRuntime(19350): at android.app.ActivityThread.main(ActivityThread.java:3837) 
06-13 15:05:43.276: E/AndroidRuntime(19350): at java.lang.reflect.Method.invokeNative(Native Method) 
06-13 15:05:43.276: E/AndroidRuntime(19350): at java.lang.reflect.Method.invoke(Method.java:507) 
06-13 15:05:43.276: E/AndroidRuntime(19350): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847) 
06-13 15:05:43.276: E/AndroidRuntime(19350): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605) 
06-13 15:05:43.276: E/AndroidRuntime(19350): at dalvik.system.NativeStart.main(Native Method) 

清單

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="pl.mm.dt" 
    android:versionCode="1" 
    android:versionName="1.0" > 

    <uses-sdk android:minSdkVersion="8" /> 

    <uses-feature android:name="android.hardware.camera" /> 

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

    <application 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" > 
     <uses-library android:name="com.google.android.maps" /> 
     <activity 
      android:name=".SplashScreen" 
      android:label="@string/app_name" 
      android:screenOrientation="portrait" 
      android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 

     <activity 
      android:name="NewNormalNoteActivity" 
      android:screenOrientation="portrait" 
      android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" > 
     </activity> 
     ... 
     <activity 
      android:name=".AddPlaceActivity" 
      android:screenOrientation="portrait" 
      android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" > 
     </activity> 


    </application> 

</manifest> 

AddPlaceActivity

package pl.mm.dt; 

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

import android.os.Bundle; 

public class AddPlaceActivity extends MapActivity{ 

    @Override 
    protected boolean isRouteDisplayed() { 
     return false; 
    } 

    @Override 
    protected void onCreate(Bundle icicle) { 
     super.onCreate(icicle); 
     setContentView(R.layout.add_place_activity); 

     MapView mapView = (MapView) findViewById(R.id.mapview); 
     mapView.setBuiltInZoomControls(true); 
    } 


} 
+0

你運行你在谷歌的API的仿真應用程序? – Praveenkumar

+0

發佈你的清單文件 – MAC

+0

我正在運行它與我的手機與android 2.3.5 – Greg

回答

1

機器人嘗試把android:name="NewNormalNoteActivity" as this android:name=".NewNormalNoteActivity"

的android:命名

The name of the class that implements the activity, a subclass of Activity. 
The attribute value should be a fully qualified class name (such as, "com.example.project.ExtracurricularActivity"). 
However, as a shorthand, if the first character of the name is a period (for example, ".ExtracurricularActivity"), 
it is appended to the package name specified in the <manifest> element. 

Android Manifest: Why sometimes ".<classname>" instead of just "<classname>"?

Is the activity name in AndroidManifest.xml required to start with a dot?

+0

仍然是一樣的錯誤 – Greg

+0

你可以給我們提供AddPlaceActivity代碼嗎? –

+0

即使這也很好........ –