升级Android应用时ClassNotFoundException的错误报告错误报告、Android、ClassNotFoundException

2023-09-07 16:41:00 作者:食言犯

我看到有关的ClassNotFoundException和Android相当多的线程,但我还没有找到什么,我觉得是我经历的原因。

我有一个应用程序 - 数据计数器部件 - Android电子市场。它有250K +的下载,我每次发布新版本时,我得到的错误报告了一把(1-5)约一个ClassNotFoundException,以在Android Market我的开发者控制台。

29份报告来自指定(其他)的设备,而两人从歌Nexus One。有两个用户消息:和启动时崩溃在安装更新​​

所有的报告都是关于我的接收器(扩展广播接收器)。其中一个接收器是比较经常,因为它是启动读取并存储在Android设备的数据使用服务的一个触发。我也有这种感觉,它可以是一个报警接收机设置(使用AlarmManager),然后在用户/设备升级应用程序和类中找不到 - 可能是因为它是在物理不同的包,或者说,它发生在片刻设备做交换。可能是这样的情况?如果是这样,它周围有什么方法?我不能看,否则为什么几乎所有的报告(比如90%)的新版本后,来自相同或未来几天的。

我的接收机之一的堆栈跟踪(别人给比类名其他相同堆栈跟踪):

 了java.lang.RuntimeException:无法实例接收com.roysolberg.android.datacounter.receivers.CounterReceiver:抛出java.lang.ClassNotFoundException:com.roysolberg.android.datacounter.receivers。 CounterReceiver装载机dalvik.system.PathClassLoader [/data/app/com.roysolberg.android.datacounter-1.apk] 在android.app.ActivityThread.handleReceiver(ActivityThread.java:2789) 在android.app.ActivityThread.access $ 3200(ActivityThread.java:125) 在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:2083) 在android.os.Handler.dispatchMessage(Handler.java:99) 在android.os.Looper.loop(Looper.java:123) 在android.app.ActivityThread.main(ActivityThread.java:4627) 在java.lang.reflect.Method.invokeNative(本机方法) 在java.lang.reflect.Method.invoke(Method.java:521) 在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:858) 在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 在dalvik.system.NativeStart.main(本机方法)抛出java.lang.ClassNotFoundException:引起com.roysolberg.android.datacounter.receivers.CounterReceiver装载机dalvik.system.PathClassLoader [/data/app/com.roysolberg.android.datacounter-1.apk] 在dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243) 在java.lang.ClassLoader.loadClass(ClassLoader.java:573) 在java.lang.ClassLoader.loadClass(ClassLoader.java:532) 在android.app.ActivityThread.handleReceiver(ActivityThread.java:2780) ... 10个 

解决方案

经过一年左右的更新我的应用我现在明白了这个问题,并似乎有它没有解决办法:

我的应用程序(根据用户设置)使用报警管理器来定期运行特定的任务。当应用程序被更新时,它是没有可用的一个短的时间周期,并且如果警报触发,这将导致该特定问题!然后应用程序再次可用,万事如意为正常。

所以我每次更新我的应用程序获得本定期报告FC有什么可以对此进行。

现在在FC报告消息,我有时会看到'崩溃,同时更新......证实了这一点。

另外关于转会到SD,我特意美元,清单文件p $ pvents,但市场上一些窗台应用允许迫使应用程序移动。所以,如果你使用的部件或报警,可以肯定也收到这样的报告!

3年13个版本重大升级 看Android如何追赶iOS

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(ZygoteInit.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!