我有这个崩溃说我的应用程序类不存在,虽然它在那里。另外,这条线是什么"Didn't find class "com.package.app.CustomApplication" on path: /mnt/asec/com.package.app-1/pkg.apk"
意思?
这是完整的崩溃日志。
java.lang.RuntimeException: Unable to instantiate application com.package.app.CustomApplication: java.lang.ClassNotFoundException: Didn't find class "com.package.app.CustomApplication" on path: /mnt/asec/com.package.app-1/pkg.apk
at android.app.LoadedApk.makeApplication(LoadedApk.java:503)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4405)
at android.app.ActivityThread.access$1400(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1327)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5059)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.package.app.CustomApplication" on path: /mnt/asec/com.package.app-1/pkg.apk
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newApplication(Instrumentation.java:967)
at android.app.LoadedApk.makeApplication(LoadedApk.java:498)
另外,这是我的AndroidManifest.xml
:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.package.app"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="preferExternal">
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<supports-screens android:largeScreens="true"
android:xlargeScreens="true"/>
<application
android:name="com.package.app.CustomApplication"
android:allowBackup="true"
android:icon="@drawable/app_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" android:largeHeap="true">
<activity
android:name="com.package.app.MainActivity"
android:alwaysRetainTaskState="true"
android:noHistory="false"
android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
这是我的CustomApplication
课:
public class CustomApplication extends Application {
private GameHandler gameHandler;
public GameHandler getGameHandler() {
if(gameHandler == null){
initGameHandler();
}
return gameHandler;
}
public void setGameHandler(GameHandler gameHandler) {
this.gameHandler = gameHandler;
}
@Override
public void onCreate() {
}
public void initGameHandler()
{
if(this.gameHandler == null){
this.gameHandler = new GameHandler(getApplicationContext());
}
}
}
任何想法?
谢谢!