我想知道为什么我得到一个上面的错误,当我试图修复我的清单。我在我的清单上宣布我的活动是这样的:
<activity
android:name="com.joyce.cit.DummyActivity"
android:label="@string/title_activity_dummy" >
<intent-filter>
<action android:name="android.intent.action.DUMMYACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
并在我的logcat上出现此错误:
07-19 10:08:52.290: E/AndroidRuntime(8852): FATAL EXCEPTION: main
07-19 10:08:52.290: E/AndroidRuntime(8852):
android.content.ActivityNotFoundException:
Unable to find explicit activity class
{com.joyce.cit.pdfview/com.joyce.cit.pdfview.DummyActivity}; have you declared this
activity in your AndroidManifest.xml?
07-19 10:08:52.290: E/AndroidRuntime(8852): at
android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1508)
07-19 10:08:52.290: E/AndroidRuntime(8852): at
android.app.Instrumentation.execStartActivity(Instrumentation.java:1384)
07-19 10:08:52.290: E/AndroidRuntime(8852): at
android.app.Activity.startActivityForResult(Activity.java:3190)
07-19 10:08:52.290: E/AndroidRuntime(8852): at
android.app.Activity.startActivity(Activity.java:3297)
07-19 10:08:52.290: E/AndroidRuntime(8852): at
com.joyce.cit.pdfview.SplashActivity$1.onClick(SplashActivity.java:30)
07-19 10:08:52.290: E/AndroidRuntime(8852): at
android.view.View.performClick(View.java:3511)
07-19 10:08:52.290: E/AndroidRuntime(8852): at
android.view.View$PerformClick.run(View.java:14110)
07-19 10:08:52.290: E/AndroidRuntime(8852): at
android.os.Handler.handleCallback(Handler.java:605)
07-19 10:08:52.290: E/AndroidRuntime(8852): at
android.os.Handler.dispatchMessage(Handler.java:92)
07-19 10:08:52.290: E/AndroidRuntime(8852): at
android.os.Looper.loop(Looper.java:137)
07-19 10:08:52.290: E/AndroidRuntime(8852): at
android.app.ActivityThread.main(ActivityThread.java:4424)
07-19 10:08:52.290: E/AndroidRuntime(8852): at
java.lang.reflect.Method.invokeNative(Native Method)
07-19 10:08:52.290: E/AndroidRuntime(8852): at
java.lang.reflect.Method.invoke(Method.java:511)
07-19 10:08:52.290: E/AndroidRuntime(8852): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-19 10:08:52.290: E/AndroidRuntime(8852): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-19 10:08:52.290: E/AndroidRuntime(8852): at
dalvik.system.NativeStart.main(Native Method)
并在我的清单上更改我的活动:
<activity
android:name=".DummyActivity"
android:label="@string/title_activity_dummy" >
<intent-filter>
<action android:name="android.intent.action.DUMMYACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
并在我的logcat中出现此错误:
07-19 10:15:31.930: E/AndroidRuntime(9038): FATAL EXCEPTION: main
07-19 10:15:31.930: E/AndroidRuntime(9038): java.lang.RuntimeException: Unable to
instantiate activity
ComponentInfo{com.joyce.cit.pdfview/com.joyce.cit.pdfview.DummyActivity}:
java.lang.InstantiationException: can't instantiate class
com.joyce.cit.pdfview.DummyActivity
07-19 10:15:31.930: E/AndroidRuntime(9038): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)
07-19 10:15:31.930: E/AndroidRuntime(9038): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
07-19 10:15:31.930: E/AndroidRuntime(9038): at
android.app.ActivityThread.access$600(ActivityThread.java:123)
07-19 10:15:31.930: E/AndroidRuntime(9038): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
07-19 10:15:31.930: E/AndroidRuntime(9038): at
android.os.Handler.dispatchMessage(Handler.java:99)
07-19 10:15:31.930: E/AndroidRuntime(9038): at
android.os.Looper.loop(Looper.java:137)
07-19 10:15:31.930: E/AndroidRuntime(9038): at
android.app.ActivityThread.main(ActivityThread.java:4424)
07-19 10:15:31.930: E/AndroidRuntime(9038): at
java.lang.reflect.Method.invokeNative(Native Method)
07-19 10:15:31.930: E/AndroidRuntime(9038): at
java.lang.reflect.Method.invoke(Method.java:511)
07-19 10:15:31.930: E/AndroidRuntime(9038): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-19 10:15:31.930: E/AndroidRuntime(9038): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-19 10:15:31.930: E/AndroidRuntime(9038): at
dalvik.system.NativeStart.main(Native Method)
07-19 10:15:31.930: E/AndroidRuntime(9038): Caused by:
java.lang.InstantiationException: can't instantiate class
com.joyce.cit.pdfview.DummyActivity
07-19 10:15:31.930: E/AndroidRuntime(9038): at
java.lang.Class.newInstanceImpl(Native Method)
07-19 10:15:31.930: E/AndroidRuntime(9038): at
java.lang.Class.newInstance(Class.java:1319)
07-19 10:15:31.930: E/AndroidRuntime(9038): at
android.app.Instrumentation.newActivity(Instrumentation.java:1023)
07-19 10:15:31.930: E/AndroidRuntime(9038): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)
07-19 10:15:31.930: E/AndroidRuntime(9038): ... 11 more
对不起,我是android新手。我才能理解这一点。请有人解释一下。非常感谢你。
答案 0 :(得分:2)
您已声明com.joyce.cit.DummyActivity
并且logcat表示您正在尝试启动com.joyce.cit.pdfview.DummyActivity
。