我已经在游戏中发布了一个成功的应用程序,但在我签署并对齐应用程序并将其安装在模拟器/真实设备上升级应用程序后,它会强制关闭并向我提供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>
答案 0 :(得分:2)
ClassNotFound异常意味着您在清单文件中错过了活动,或者您没有给出活动的正确名称。
答案 1 :(得分:0)
您使用的是ProGuard吗?它可能会混淆一些不会被混淆的类,因为它们是在xml文件(例如AndroidManifest.xml
)中引用的。有关ProGuard的更多信息,请访问here。