0

我今天才开始使用 android 应用程序,所以我没有添加任何 jar。如果有帮助,我目前正在使用 sdk 和 adt r19。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)
4

1 回答 1

1

您是否在应用程序的清单文件中定义了use-library标记?

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

像,

 <application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >

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

    .
    .
     .
</application>

还要检查您的应用程序是否包含Google-apinot Android

于 2012-07-13T07:00:58.683 回答