运行Android应用程序时出错(无法找到显式活动类)

时间:2013-10-29 04:55:06

标签: android performance android-layout

10-25 05:30:06.560: W/dalvikvm(1428): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
10-25 05:30:06.670: E/AndroidRuntime(1428): FATAL EXCEPTION: main
10-25 05:30:06.670: E/AndroidRuntime(1428): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.androidhiv/com.example.androidhiv.AllProductsActivity}; have you declared this activity in your AndroidManifest.xml?
10-25 05:30:06.670: E/AndroidRuntime(1428):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1618)
10-25 05:30:06.670: E/AndroidRuntime(1428):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
10-25 05:30:06.670: E/AndroidRuntime(1428):     at android.app.Activity.startActivityForResult(Activity.java:3370)
10-25 05:30:06.670: E/AndroidRuntime(1428):     at android.app.Activity.startActivityForResult(Activity.java:3331)
10-25 05:30:06.670: E/AndroidRuntime(1428):     at android.app.Activity.startActivity(Activity.java:3566)
10-25 05:30:06.670: E/AndroidRuntime(1428):     at android.app.Activity.startActivity(Activity.java:3534)
10-25 05:30:06.670: E/AndroidRuntime(1428):     at com.example.androidhiv.MainScreenActivity$1.onClick(MainScreenActivity.java:31)
10-25 05:30:06.670: E/AndroidRuntime(1428):     at android.view.View.performClick(View.java:4204)
10-25 05:30:06.670: E/AndroidRuntime(1428):     at android.view.View$PerformClick.run(View.java:17355)
10-25 05:30:06.670: E/AndroidRuntime(1428):     at android.os.Handler.handleCallback(Handler.java:725)
10-25 05:30:06.670: E/AndroidRuntime(1428):     at android.os.Handler.dispatchMessage(Handler.java:92)
10-25 05:30:06.670: E/AndroidRuntime(1428):     at android.os.Looper.loop(Looper.java:137)
10-25 05:30:06.670: E/AndroidRuntime(1428):     at android.app.ActivityThread.main(ActivityThread.java:5041)
10-25 05:30:06.670: E/AndroidRuntime(1428):     at java.lang.reflect.Method.invokeNative(Native Method)
10-25 05:30:06.670: E/AndroidRuntime(1428):     at java.lang.reflect.Method.invoke(Method.java:511)
10-25 05:30:06.670: E/AndroidRuntime(1428):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
10-25 05:30:06.670: E/AndroidRuntime(1428):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
10-25 05:30:06.670: E/AndroidRuntime(1428):     at dalvik.system.NativeStart.main(Native Method)

4 个答案:

答案 0 :(得分:1)

确保此活动在Android清单中注册

答案 1 :(得分:0)

您尚未在清单文件中声明您的活动 AllProductsActivity ,并且编译器无法找到该活动因此抛出错误。

在清单文件中声明活动 AllProductsActivity

像这样

<activity android:name="com.example.androidhiv.AllProductsActivity"
            ></activity>

答案 2 :(得分:0)

它表明您尚未在清单文件中声明AllProductsActivity

  <activity
        android:name="com.example.androidhiv.AllProductsActivity"
        />

答案 3 :(得分:0)

您必须声明要在应用程序中显示的每个Acticity必须在AndroidManifest.xml文件中声明。

<activity android:name="com.example.androidhiv.AllProductsActivity" />