- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我们的应用程序的 1800 名用户(每月活跃用户数为 1.2)(根据 Google Developer Console)发生了这次崩溃。非常罕见,但确实会发生。
Android 4.1 最多 6,但报告中没有 Android 7。
BaseDexClassLoader 中这个 ClassNotFoundException 的性质可能是什么。我们能避免吗?
java.lang.RuntimeException: at android.app.LoadedApk.makeApplication(LoadedApk.java:572) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4831) at android.app.ActivityThread.access$1500(ActivityThread.java:178)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1531)
at android.os.Handler.dispatchMessage(Handler.java:111) at android.os.Looper.loop(Looper.java:194) at android.app.ActivityThread.main(ActivityThread.java:5637) at java.lang.reflect.Method.invoke(Method.java:0) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)Caused by: java.lang.ClassNotFoundException: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:469) at android.app.Instrumentation.newApplication(Instrumentation.java:985)
at android.app.LoadedApk.makeApplication(LoadedApk.java:567)
最佳答案
NOTE: The answer below could be inaccurate and not verifiable, because this Exception is pretty impossibile to simulate in a test environment. If someone has more informations on the topic or maybe a definitive solution please post it here. I apologize in advance if this informations will be proved to be false at all but they are based on my experience and understanding of the thing
java.lang.ClassNotFoundException
有多个变体在 Android 中,大多数是由于 Proguard 配置错误、IDE 在构建时未正确关闭设备先前启动的实例等引起的...
所有这些“正常”ClassNotFoundException
s 是可区分的,因为在异常的某些部分,有一些与应用程序本身相关的东西,比如:
java.lang.RuntimeException: Unable to instantiate application com.my.package.CustomApplication: java.lang.NullPointerException
或
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.my.package/com.my.package.MyClass}: java.lang.ClassNotFoundException: Didn't find class "com.my.package.MyClass" on path: DexPathList[[zip file "/data/app/com.my.package-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.my.package-1, /vendor/lib, /system/lib]]
虽然您面对的是与您的应用程序完全无关的东西,因为很明显没有对您的应用程序组件的引用。当您的应用因更新而卸载并重新安装时,系统加载 APK 并尝试执行您的某些代码(如 Receiver)的方式存在错误。
我认为这里发生的是:
- The app is installed
- The system wants to start one of your components (for example a
<receiver>
)- The app is uninstalled because of a new update (this step should last only few seconds)
- The system is not able to find anymore your app and throw the error you posted
- The update is installed and your app start working again
这些因素的组合可以解释为什么考虑到活跃用户总数,您只有“少量”崩溃。
对此你能做什么?我认为没什么,因为这是系统处理这种特殊情况的错误。 This comment在多个相关问题之一中有相同的结论。
您可以尝试创建自定义 ClassLoader
您可以自己处理异常并静默终止应用程序进程而不会导致应用程序崩溃,这样您的用户就不会注意到任何事情(我不知道用户是否真的注意到了这一点,也许这是由处理的内部异常系统和用户什么都看不到)
您没有遇到针对 Android 7 的报告这一事实可能表明他们已在最新的 Android 版本 LoadedApk 中解决了该问题。类
PS:老实说,我认为这与多索引无关,但您可以进行一些测试以确保
关于android - BaseDexClassLoader 意外崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44278561/
在我升级到64位armeabi库并打包发布到googleplay后,在googleplay崩溃报告页面遇到如下问题: java.lang.RuntimeException: at android.
无法运行以下项目,并且项目中没有错误。我已经多次运行该项目。请任何人帮助我解决问题。 Androidmanifest.xml:
这个错误在 Stackoverflow 上出现过几次,我会引用这个问题中的其他问题。 我的项目是一个使用 Android Maven Plugin 的 Android 应用程序包括库,但也包括本地的一
我们的应用程序的 1800 名用户(每月活跃用户数为 1.2)(根据 Google Developer Console)发生了这次崩溃。非常罕见,但确实会发生。 Android 4.1 最多 6,但报
我在生产构建中遇到了 ClassNotFoundException。 请在下面找到异常日志。 java.lang.RuntimeException: at android.app.LoadedApk.
目前在我的生产应用中我注意到这个错误: java.lang.RuntimeException: at android.app.ActivityThread.handleReceiver (Acti
对此进行了一些研究,并发现了一些关于在应用程序中面临相同问题的人的帖子。我也在我的应用程序的谷歌控制台中遇到了这个崩溃,并关注了我发现的帖子( java.lang.ClassNotFoundExcep
我在使用 JSONSerializer 时遇到问题。我有这个方法: public List transferToDomain(String pJSON) { List lAllBusi
伙计们,我的 apk 可以在我自己的手机上运行,但我将它附加到 Google Play 商店。我从商店安装了应用程序,但它不起作用。当我检查开发人员控制台时,我看到了这个错误。请帮助我,我该怎么办
我的 Google Play 开发者控制台不断收到此错误报告。看起来像 MultiDex 错误。 java.lang.RuntimeException: at android.app.Loaded
正如我在开发人员控制台中看到的那样,我在我的 Android 应用程序中收到了很多来自用户的崩溃报告。我看到的堆栈跟踪是: java.lang.RuntimeException: at andro
这个错误快把我逼疯了。从 Google Play 商店下载时,我的应用程序在启动时崩溃并出现错误: java.lang.ClassNotFoundException in dalvik.system.
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.me.hexavoidaa/com.me.he
我有这个崩溃,说我的应用程序类不存在,尽管它在那里。另外,这行 "Didn't find class "com.package.app.CustomApplication"on path:/mnt/a
我在 Google Play 控制台上收到 dalvik.system.BaseDexClassLoader.findClass ClassNotFoundException 崩溃报告。崩溃几乎只发生
所以我的项目编译和运行良好,我将 AndroidAnnotations @RestService 注入(inject)到我的 MainActivity @EActivity(R.layout.acti
我是一名优秀的程序员,十分优秀!