0

我想知道为什么在尝试修复清单时出现上述错误。我在我的清单上声明我的活动是这样的:

<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

对不起,我是安卓新手。我只能理解这一点。请有人解释一下。非常感谢您。

4

1 回答 1

2

您已经声明com.joyce.cit.DummyActivity并且 logcat 说您正在尝试启动com.joyce.cit.pdfview.DummyActivity

于 2013-07-19T02:17:58.843 回答