开发者

ClassNotFoundException error reports when upgrading Android app

开发者 https://www.devze.com 2023-02-28 21:52 出处:网络
I\'ve seen quite a few threads about ClassNotFoundException and Android, but I have yet to find what I think is the reason for what I experience.

I've seen quite a few threads about ClassNotFoundException and Android, but I have yet to find what I think is the reason for what I experience.

I have an app - Data counter widget - on Android Market. It has 250k+ downloads, and every time I release a new version I get a handful (1-5) of error reports about a ClassNotFoundException to my developer console in Android Market.

29 reports are from unspecified ('OTHER') devices, while two are from the Nexus One. There are two user messages: 'Crashes on startup' and 'During update install'.

All the reports are about my receivers (extends BroadcastReceiver). One of the receivers is triggered relatively often as it is the one that starts the service that reads and stores the data usage of the Android device. I have this feeling that it can be that an alarm is set (using AlarmManager) for the receiver and then the user/device upgrades the app and the class is not found - either because it's in a physical different package, or that it happens the moment the device does the swap. Could this be the case? And if so, are there any ways around it? I can't otherwise see why almost all reports (say 90%) comes on the same or next couple of days after a new release.

The stacktrace for one of my receivers (the others give the same stacktrace other than the class name):

java.lang.RuntimeException: Unable to instantiate receiver com.roysolberg.android.datacounter.receivers.CounterReceiver: java.lang.ClassNotFoundException: com.roysolberg.android.datacounter.receivers.CounterReceiver in loader dalvik.system.PathClassLoader[/data/app/com.roysolberg.android.datacounter-1.apk]
 at android.app.ActivityThread.handleReceiver(ActivityThread.java:2789)
 at android.app.ActivityThread.access$3200(ActivityThread.java:125)
 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2083)
 at android.os.Handler.dispatchMessage(Handler.java:99)
 at android.os.Looper.loop(Looper.java:123)
 at android.app.ActivityThread.main(ActivityThread.java:4627)
 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:858)
 at com.android.internal.os.ZygoteInit.main(Zyg开发者_运维百科oteInit.java:616)
 at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.roysolberg.android.datacounter.receivers.CounterReceiver in loader dalvik.system.PathClassLoader[/data/app/com.roysolberg.android.datacounter-1.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.ActivityThread.handleReceiver(ActivityThread.java:2780)
 ... 10 more


After a year or so updating my apps I now understand the issue and there seems to be no solutions to it:

My apps (depending on user settings) use the Alarm Manager to run specific tasks at regular intervals. When the app is updated, it is not available for a short period of time, and if the alarm triggers, this causes that specific issue! Then the app becomes available again and everything goes as normal.

So I get this FC report regularly each time I update my apps and there's nothing that can be done about it.

Now in the FC report messages, I sometimes see 'crashed while updating'... Confirms it.

Also concerning the move to SD, I specifically prevents it from the manifest file, but some apps on market sill allows forcing an app to be moved. So if you use widgets or alarms, you could also definitely receive such reports!


Suppose, this problem is very similar to Android app fails to load on some phones in PathClassLoader.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号