无法实例化活动ComponentInfo

时间:2014-02-27 22:20:41

标签: java android

我看过所有其他标题为Unable to instantiate activity ComponentInfo的问题(并且有很多问题!)但我无法找到解决问题的正确方法。这就是我再次提出这个问题的原因。

因此,在从GitHub分配项目并自定义源代码之后,我终于完成了我的应用程序,但遗憾的是它在我的设备上启动它时无效(Nexus 7 2012)。 Logcat引发了以下错误:

   0227 23:10:49.182: D/dalvikvm(23626): Late-enabling CheckJNI
   0227 23:10:49.242: W/dalvikvm(23626): Unable to resolve superclass of Lcom/nerdability/android/ArticleListActivity; (17)
   0227 23:10:49.242: W/dalvikvm(23626): Link of class 'Lcom/nerdability/android/ArticleListActivity;' failed
   0227 23:10:49.242: D/AndroidRuntime(23626): Shutting down VM
   0227 23:10:49.242: W/dalvikvm(23626): threadid=1: thread exiting with uncaught exception (group=0x41837ba8)
   0227 23:10:49.242: E/AndroidRuntime(23626): FATAL EXCEPTION: main
   0227 23:10:49.242: E/AndroidRuntime(23626): Process: com.nerdability.android, PID: 23626
   0227 23:10:49.242: E/AndroidRuntime(23626): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.nerdability.android/com.nerdability.android.ArticleListActivity}: java.lang.ClassNotFoundException: Didn't find class "com.nerdability.android.ArticleListActivity" on path: DexPathList[[zip file "/data/app/com.nerdability.android-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.nerdability.android-2, /vendor/lib, /system/lib]]
   0227 23:10:49.242: E/AndroidRuntime(23626):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
   0227 23:10:49.242: E/AndroidRuntime(23626):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
   0227 23:10:49.242: E/AndroidRuntime(23626):  at android.app.ActivityThread.access$800(ActivityThread.java:135)
   0227 23:10:49.242: E/AndroidRuntime(23626):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
   0227 23:10:49.242: E/AndroidRuntime(23626):  at android.os.Handler.dispatchMessage(Handler.java:102)
   0227 23:10:49.242: E/AndroidRuntime(23626):  at android.os.Looper.loop(Looper.java:136)
   0227 23:10:49.242: E/AndroidRuntime(23626):  at android.app.ActivityThread.main(ActivityThread.java:5017)
   0227 23:10:49.242: E/AndroidRuntime(23626):  at java.lang.reflect.Method.invokeNative(Native Method)
   0227 23:10:49.242: E/AndroidRuntime(23626):  at java.lang.reflect.Method.invoke(Method.java:515)
   0227 23:10:49.242: E/AndroidRuntime(23626):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
   0227 23:10:49.242: E/AndroidRuntime(23626):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
   0227 23:10:49.242: E/AndroidRuntime(23626):  at dalvik.system.NativeStart.main(Native Method)
   0227 23:10:49.242: E/AndroidRuntime(23626): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.nerdability.android.ArticleListActivity" on path: DexPathList[[zip file "/data/app/com.nerdability.android-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.nerdability.android-2, /vendor/lib, /system/lib]]
   0227 23:10:49.242: E/AndroidRuntime(23626):  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
   0227 23:10:49.242: E/AndroidRuntime(23626):  at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
   0227 23:10:49.242: E/AndroidRuntime(23626):  at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
   0227 23:10:49.242: E/AndroidRuntime(23626):  at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
   0227 23:10:49.242: E/AndroidRuntime(23626):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112)
   0227 23:10:49.242: E/AndroidRuntime(23626):  ... 11 more

我完全不知道为什么它会说“找不到课程”,即使应用程序运行所需的一切都在那里。我是Java和Android开发的新手,所以我确定我在问一个愚蠢的问题......

清单

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nerdability.android"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="15" />
<uses-permission
    android:name="android.permission.INTERNET" />

<application
    android:icon="@drawable/rssicon"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".ArticleListActivity"
        android:label="@string/title_article_list" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.nerdability.android.ArticleDetailActivity"
        android:label="@string/title_article_detail" >
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value=".ArticleListActivity" />
    </activity>
</application>

</manifest>

ArticleListActivity http://pastebin.com/x8D0ZMch

0 个答案:

没有答案