0

我已经发布了一个成功的应用程序,但是在升级应用程序后,当我签署并对齐应用程序并将其安装在模拟器/真实设备上时,它会强制关闭并给我ClassNotFound异常。

03-15 16:09:08.280: E/AndroidRuntime(7122): java.lang.RuntimeException: Unable to instantiate application william.shakespeare.MyBaseClass: java.lang.ClassNotFoundException: william.shakespeare.MyBaseClass
03-15 16:09:08.280: E/AndroidRuntime(7122):     at android.app.LoadedApk.makeApplication(LoadedApk.java:482)
03-15 16:09:08.280: E/AndroidRuntime(7122):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3909)
03-15 16:09:08.280: E/AndroidRuntime(7122):     at android.app.ActivityThread.access$1300(ActivityThread.java:122)
03-15 16:09:08.280: E/AndroidRuntime(7122):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1184)
03-15 16:09:08.280: E/AndroidRuntime(7122):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-15 16:09:08.280: E/AndroidRuntime(7122):     at android.os.Looper.loop(Looper.java:137)
03-15 16:09:08.280: E/AndroidRuntime(7122):     at android.app.ActivityThread.main(ActivityThread.java:4340)
03-15 16:09:08.280: E/AndroidRuntime(7122):     at java.lang.reflect.Method.invokeNative(Native Method)
03-15 16:09:08.280: E/AndroidRuntime(7122):     at java.lang.reflect.Method.invoke(Method.java:511)
03-15 16:09:08.280: E/AndroidRuntime(7122):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-15 16:09:08.280: E/AndroidRuntime(7122):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-15 16:09:08.280: E/AndroidRuntime(7122):     at dalvik.system.NativeStart.main(Native Method)
03-15 16:09:08.280: E/AndroidRuntime(7122): Caused by: java.lang.ClassNotFoundException: william.shakespeare.MyBaseClass
03-15 16:09:08.280: E/AndroidRuntime(7122):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
03-15 16:09:08.280: E/AndroidRuntime(7122):     at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
03-15 16:09:08.280: E/AndroidRuntime(7122):     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
03-15 16:09:08.280: E/AndroidRuntime(7122):     at android.app.Instrumentation.newApplication(Instrumentation.java:942)
03-15 16:09:08.280: E/AndroidRuntime(7122):     at android.app.LoadedApk.makeApplication(LoadedApk.java:477)
03-15 16:09:08.280: E/AndroidRuntime(7122):     ... 11 more

这是我的清单文件:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="william.shakespeare"
    android:versionCode="2"
    android:versionName="1.1" >

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

    <uses-permission android:name="android.permission.VIBRATE"/>
    <uses-permission android:name="android.permission.ACTION_SEND"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.BLUETOOTH"/>
    <user-permission android:name="android.permission.WRITE_SETTINGS" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.GET_TASKS"/>

    <application
        android:icon="@drawable/ic_launcher"
        android:theme="@android:style/Theme.Holo.NoActionBar"
        android:label="William Shakespeare Quotes"
        android:launchMode="singleInstance"
        android:name="william.shakespeare.MyBaseClass"
        >

        <activity
            android:name=".Splash_Screen"
            android:label="@string/title_activity_splash__screen"
            android:launchMode="singleInstance"
            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=".AboutUs" android:launchMode="singleInstance" android:screenOrientation="portrait"></activity>
        <activity android:name=".Biography" android:launchMode="singleInstance" android:screenOrientation="portrait" ></activity>
        <activity android:name=".Category_List" android:launchMode="singleInstance" android:screenOrientation="portrait" ></activity>
        <activity android:name=".Favourite_Quote" android:launchMode="singleInstance" android:screenOrientation="portrait"></activity>
        <activity android:name=".Favourite_Single_Quote" android:launchMode="singleInstance" android:screenOrientation="portrait" ></activity>
        <activity android:name=".Help" android:launchMode="singleInstance" android:screenOrientation="portrait" ></activity>
        <activity android:name=".MainMenu" android:launchMode="singleInstance" android:screenOrientation="portrait" ></activity>
        <activity android:name=".MyCustomActionBar" android:launchMode="singleInstance" android:screenOrientation="portrait"></activity>
        <activity android:name=".Quote_List" android:launchMode="singleInstance" android:screenOrientation="portrait" ></activity>
        <activity android:name=".QuotesIn_Category" android:launchMode="singleInstance" android:screenOrientation="portrait" ></activity>
        <activity android:name=".SearchFrom" android:launchMode="singleInstance" android:screenOrientation="portrait"></activity>
        <activity android:name=".Settings" android:launchMode="singleInstance" android:screenOrientation="portrait" ></activity>
        <activity android:name=".Single_Category" android:launchMode="singleInstance" android:screenOrientation="portrait"></activity>
        <activity android:name=".Single_Quote" android:launchMode="singleInstance" android:screenOrientation="portrait" ></activity>

        <activity android:name="com.google.ads.AdActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

        <receiver android:name=".Quote_Of_Day"/>
        <receiver android:name=".Notification_Quote"/>
        <receiver android:name=".Boot_Receiver">
    <intent-filter>  
        <action android:name="android.intent.action.BOOT_COMPLETED" />  
    </intent-filter>  
</receiver>
 </application>   
 </manifest>
4

2 回答 2

2

ClassNotFound 异常意味着在您的清单文件中您错过了 Activity,或者您可能没有给出正确的 Activity 名称。

于 2013-03-15T11:23:39.760 回答
0

你用过 ProGuard 吗?它可能混淆了一些不应该混淆的类,因为它们在 xml 文件(AndroidManifest.xml例如)或其他东西中被引用。更多关于 ProGuard 的信息可以在这里找到。

于 2013-03-15T11:24:13.550 回答