Hi,
I've noticed that a large number of my apps that I am publishing in Google Play have crashes (shown in the "Crash and ANR" tab) that look like this.
java.lang.RuntimeException: Unable to instantiate application com.domain.app.MainApplication: java.lang.ClassNotFoundException: com.domain.app.MainApplication
at android.app.LoadedApk.makeApplication(LoadedApk.java:501)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4265)
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:4962)
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:1004)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.domain.app.MainApplication
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
Note that all my apps are pretty much independent of each other and do not have shared code.
From the Google Play developer console, I've noticed that these crashes mostly occur when the app is being updated. My guess is that when the PackageManager attempts to update my app, that the Android platform is not completely stopping my app. Therefore, since the app is still running while the APK is being removed, when the app needs code or any resources, it is unable to locate it (apk has been deleted during update) and therefore throws this exception.
Again, this exception is intermittent. Out of every 100 or so updates, this crash will appear once or twice.
Has anyone else experienced this? My theory is that the platform itself must be buggy, but I am unable to confirm this. Is there a way for me to confirm this is a platform issue?
Thanks!
J