3

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?

1 Answer 1

2

Update(4/26/15):

After further research I believe you are right in the fact that its definitely a user error. The [/mnt/asec/PACKAGE_NAME-1/pkg.apk] most likely means they are trying to move your app to the SD card. Please read here:

Android intermittent class not found run time exception

"Unable to instantiate activity" error

Android: Unable to instantiate activity / ClassNotFoundException

Original:

This is a Java RuntimeException as seen by Logcat. I've seen this happen many times before when I have not added the Activity to manifest correctly.

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]
Sign up to request clarification or add additional context in comments.

4 Comments

Thank you! My manifest is okay, of course. This is why I wrote that the bug occurs extremely seldom. <activity android:name=".MainActivity" android:launchMode="singleTask" ...><intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" /></intent-filter></activity> Can this be the user's device's fault as it probably doesn't load the manifest correctly or so?
I believe you are right in the fact this is a user error, please read my updated response :)
Thank you very much :) So they are probably using a third-party app to move my app to the SD card although they shouldn't?
I am guessing so. If the default(natural) way of moving the app to the sd card is not available, technically they should not do it, so it must be a 3rd party application.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.