For my Android application, I get the following error in Google Play's developer console:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{PACKAGE_NAME/PACKAGE_NAME.MainActivity}: java.lang.ClassNotFoundException: PACKAGE_NAME.MainActivity in loader dalvik.system.PathClassLoader[/mnt/asec/PACKAGE_NAME-1/pkg.apk]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1573)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3693)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: PACKAGE_NAME.MainActivity in loader dalvik.system.PathClassLoader[/mnt/asec/PACKAGE_NAME-1/pkg.apk]
at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1565)
Although this error appears extremely rarely (and can probably be neglected), I find it cleaner to have a error-free developer console :) And furthermore, I would just like to know the causes for this error.
Yes, it seems as if there was a class that could not be found. But why? How can I prevent this?