Android intermittent class not found run time exception
Asked Answered
F

1

5

One or two of my users experience the above class not found run time exception when trying to run my app.

How can that happen and how can I fix it? Is it a bad install?

Thanks

Paul

Stack trace received through Android Publishers site. I cannot replicate this myself. (com.android.app.app.app) is the name of the app/activity as defined in the manifest.

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{my,app.app.app/com.android.app.app.app}: java.lang.ClassNotFoundException: com.android.app.app.app in loader dalvik.system.PathClassLoader[/mnt/asec/my,app.app.app-1/pkg.apk] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2659) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2753) at android.app.ActivityThread.access$2500(ActivityThread.java:129) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2107) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:143) at android.app.ActivityThread.main(ActivityThread.java:4701) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassNotFoundException: com.android.app.app.app in loader dalvik.system.PathClassLoader[/mnt/asec/my,app.app.app-1/pkg.apk] at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243) at java.lang.ClassLoader.loadClass(ClassLoader.java:573) at java.lang.ClassLoader.loadClass(ClassLoader.java:532) at android.app.Instrumentation.newActivity(Instrumentation.java:1021) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2651) ... 11 more

Fussy answered 30/3, 2011 at 8:37 Comment(15)
Some more info will be useful.Declamatory
Like what? Surely a class not found run time exception either happens 100% or not at all?Fussy
Like, the use of any third party API, native code, or anything else you suspect can cause such exception.Declamatory
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{my,app.app.app/com.android.app.app.app}: java.lang.ClassNotFoundException: com.android.app.app.app in loader dalvik.system.PathClassLoader[/mnt/asec/my,app.app.app-1/pkg.apk] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2659)Fussy
I use jni, but the point is, how can this happen, either the class exists or it doesnt right? I don't understand how it may or may not be there unless Google are maybe allowing users to download apps their devices can't handle?Fussy
Is your app using any device specific hardware resource?Declamatory
I wouldn't say device specific, but it requests the use Of GPS, accelerometer and touch screen, these are marked as such in the manifest file. Shouldn't Android market filter those devices out though? I appreciate your help.Fussy
@Paul S: Consider posting a complete real stack trace. There is no com.android.app.app.app package in Android, unless some hardware manufacturer put one there.Egomania
I changed the name as this is the package name of the app/activity. Nothing untoward there. I guess that would suggest a complete failure of installation? With regards to a full stack trace, how would I do that with the limited amount of characters you can enter on this site?Fussy
I've seen this stack trace before in my Error's console for an app on the Market.Halfhour
@Blundell: Did you manage to resolve it?Fussy
@Paul No i didn't :-( it was my class that extended Application, and the app was on their SD card at the time. But I haven't seen it again since. It could of been he got a glitch in his download stream.Halfhour
Yeh, looks like one of those problems you just can't catch as it's the main activity class. Still, I would prefer not to receive a bad rating for a problem out of my control but I digress. Thanks all.Fussy
+1 Data Point for another app that has seen such an error.Housebroken
what version of android is the stack trace?Cockney
R
2

I'd check to see if these users are installing the app on an SD card: if the app is installed the app icon might be visible in the application list (since that is stored on-device) but if the SD card is unavailable (removed or maybe mounted for reading by a PC over USB) when the user taps the application icon the attempts to load will fail. You will notice:

ComponentInfo{my,app.app.app/com.android.app.app.app}: java.lang.ClassNotFoundException: com.android.app.app.app in loader dalvik.system.PathClassLoader[/mnt/asec/my,app.app.app-1/pkg.apk] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2659) at 

in your stack trace above: is /mnt/asec the SD card storage path on the device?

Reganregard answered 12/5, 2011 at 4:46 Comment(3)
Hi Femi, Looking at androidforums.com/droid-all-things-root/… It appears /mnt/asec is where encrypted virtual drives are stored containing the package when storing it on the SD card. Still, how to catch the exception?Fussy
You can't catch the exception: your code is not present on the device at all, so you can't catch it. If the SD card is mounted over USB or removed then none of your code is currently available. Tell the user they can't remove the SD/mount the SD and use the app at the same time.Reganregard
Femi, thats what I thought. Nice of Android to blame the app for something it can do absolutely nothing about. Thanks for your help.Fussy

© 2022 - 2024 — McMap. All rights reserved.