我今天才開始在android應用程序中,所以我沒有添加任何罐子。如果有幫助,我目前使用sdk和adt r19。 Android清單看起來像NoClassDefFoundError在沒有外部罐子的android
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".LoginActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".UserHome"></activity>
</application>
它是如何發生的:
btnLogin.setOnClickListener(new OnClickListener(){
public void onClick(View arg0){
Intent mapIntent = new Intent(LoginActivity.this, UserHome.class);
LoginActivity.this.startActivity(mapIntent);
Log.i("Intent", "Login to UserHome");
}
});
我無能,爲什麼發生這種情況。
編輯
錯誤日誌
07-13 06:14:06.844: E/AndroidRuntime(442): FATAL EXCEPTION: main
07-13 06:14:06.844: E/AndroidRuntime(442): java.lang.NoClassDefFoundError: com.srd.application.UserHome
07-13 06:14:06.844: E/AndroidRuntime(442): at com.srd.application.LoginActivity$1.onClick(LoginActivity.java:70)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.view.View.performClick(View.java:2408)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.view.View.onKeyUp(View.java:4121)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.widget.TextView.onKeyUp(TextView.java:4431)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.view.KeyEvent.dispatch(KeyEvent.java:1061)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.view.View.dispatchKeyEvent(View.java:3740)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:788)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:788)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:788)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:788)
07-13 06:14:06.844: E/AndroidRuntime(442): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:1667)
07-13 06:14:06.844: E/AndroidRuntime(442): at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1102)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.app.Activity.dispatchKeyEvent(Activity.java:2063)
07-13 06:14:06.844: E/AndroidRuntime(442): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1643)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2471)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2441)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.view.ViewRoot.handleMessage(ViewRoot.java:1735)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.os.Handler.dispatchMessage(Handler.java:99)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.os.Looper.loop(Looper.java:123)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-13 06:14:06.844: E/AndroidRuntime(442): at java.lang.reflect.Method.invokeNative(Native Method)
07-13 06:14:06.844: E/AndroidRuntime(442): at java.lang.reflect.Method.invoke(Method.java:521)
07-13 06:14:06.844: E/AndroidRuntime(442): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-13 06:14:06.844: E/AndroidRuntime(442): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-13 06:14:06.844: E/AndroidRuntime(442): at dalvik.system.NativeStart.main(Native Method)
究竟找不到什麼類? – Egor 2012-07-13 06:48:25
請發佈您的錯誤日誌。 – pierrotlefou 2012-07-13 06:49:18
@Egor UserHome類。當前發佈由logcat – consprice 2012-07-13 06:49:37