I already asked to find a solution to this problem, but I can not get a good answer for me. Therefore, I am trying to write a question in more detail.
The following error sometimes occurs for some users. I did not see it through several Android phones that I have for testing, but I received this distribution through the Google developer console about once a week :(
I tried to find a solution to this problem for a long time. Some people say that this may be due to exteranl material of the SD card or to the material of Singletone.
Also, in the previous question, the grateful guy said that I should check the "name" attribute of the Applcation tag in AndroidManifest.xml. But I already put the package name on it, so I don’t think that this is the reason for crushing.
I tested an external SD card on which I installed the application on an external SD card and then disconnected it. But I could not re-produce.
And about the Singletone application, My App does not use an instance of the Custom Application class anywhere. Therefore, I think that Singletone material cannot be the cause of this problem.
Even I don’t know how to repress it again, so I really need a document or public material about it.
I am sure that there is someone who received this error and already knows how to solve it. So please help me find out what happened and how I can fix it. Nice day, thanks.
Error:
java.lang.RuntimeException: Unable to instantiate application com.***.***.MyApplication: java.lang.ClassNotFoundException: com.***.***.MyApplication at android.app.LoadedApk.makeApplication(LoadedApk.java:501) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4253) at android.app.ActivityThread.access$1400(ActivityThread.java:143) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1301) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4950) 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:997) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:764) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassNotFoundException: com.***.***.MyApplication 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:982) at android.app.LoadedApk.makeApplication(LoadedApk.java:496) ... 11 more
MyApplication.java:
public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); ... } @Override public void onTerminate() { super.onTerminate(); } ... }
AndroidManifest.xml:
... <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> ... <application android:name="com.***.***.MyApplication" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" >