java.lang.ClassNotFoundException:在路径上找不到类:[packagename.activityname] DexPathList [[zip file“/data/app/<packagename>-1.apk”] </packagename>

时间:2014-10-15 10:32:19

标签: android android-manifest classnotfoundexception

我正面对下面提到的LogCat错误。

10-15 05:01:48.477: E/AndroidRuntime(1600): Process: com.thehealthsite, PID: 1600
 java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.thehealthsite/com.thehealthsite.ui.StoryListActivity}: java.lang.ClassNotFoundException: Didn't find class "com.thehealthsite.ui.StoryListActivity" on path: DexPathList[[zip file "/data/app/com.thehealthsite-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.thehealthsite-1, /system/lib]]
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
    at android.app.ActivityThread.access$800(ActivityThread.java:135)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5017)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
    at dalvik.system.NativeStart.main(Native Method)
 Caused by: java.lang.ClassNotFoundException: Didn't find class "com.thehealthsite.ui.StoryListActivity" on path: DexPathList[[zip file "/data/app/com.thehealthsite-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.thehealthsite-1, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
    at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112)
    ... 11 more

虽然我已经提到了我的清单文件中的所有内容。我的manifest.xml文件如下: -

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.thehealthsite"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="20" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:logo="@drawable/ic_launcher"
        android:theme="@style/Theme.Healthsite" 
        android:hardwareAccelerated="true">
       <activity android:name="com.thehealthsite.ui.StoryListActivity"
                  android:label="@string/app_name"
                  android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name="com.thehealthsite.ui.StoryDetails2"
                android:logo="@drawable/ic_launcher"
                android:configChanges="keyboardHidden|orientation|screenSize"
                android:screenOrientation="sensor">
                <intent-filter>
                <action android:name="com.thehealthsite.ui.StoryDetailIntent2.LAUNCH" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.item/vnd.bgr.story" />
                </intent-filter>
        </activity>

        <activity android:name="com.thehealthsite.ui.ClickedUrl"
            android:logo="@drawable/ic_launcher"
            android:configChanges="orientation|screenLayout">

        </activity>

        <activity android:name="com.thehealthsite.ui.FilteredStoryListActivity"
                  android:screenOrientation="portrait" />
        <activity android:name="com.thehealthsite.ui.StoryCommentActivity" />
        <activity android:name="com.thehealthsite.ui.DisqusComment" />
        <activity android:name="com.google.ads.AdActivity"
                android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />

        <activity
            android:name="com.thehealthsite.ui.GalleryViewShow"
            android:screenOrientation="portrait" />
        <provider
            android:name="com.thehealthsite.provider.StoryProvider"
            android:authorities="com.thehealthsite" />
    </application>

</manifest>

我尝试了所有其他可能的方法,例如清除项目,添加外部罐子。几次重启Eclipse,但没有任何对我有用。

注意: - 如果我在Samsung Galaxy S3上运行相同的项目,则不会获得任何logcat输出,并且应用程序只会崩溃,而如果我在模拟器上运行App,则会提供LogCat输出和崩溃,因此我提供的LogCat输出是我的模拟器。

任何帮助都会得到赞赏。

1 个答案:

答案 0 :(得分:-1)

尝试删除项目和应用程序的“构建”目录,然后重建项目。