三星手机中有一个奇怪的例外,特别是Galaxy S7 Edge,我们在Fabric崩溃报告中注意到了这一点:
Fatal Exception: java.lang.RuntimeException: Unable to instantiate receiver com.someapp: java.lang.ClassNotFoundException: Didn't find class "com.someapp" on path: DexPathList[[zip file "/data/app/com.someapp-1/base.apk"],nativeLibraryDirectories=[/data/app/com.someapp-1/lib/arm, /system/fake-libs, /data/app/com.someapp-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3331)
at android.app.ActivityThread.-wrap20(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1734)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6688)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
Caused by java.lang.ClassNotFoundException: Didn't find class "com.someapp" on path: DexPathList[[zip file "/data/app/com.someapp-1/base.apk"],nativeLibraryDirectories=[/data/app/com.someapp-1/lib/arm, /system/fake-libs, /data/app/com.someapp-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3326)
at android.app.ActivityThread.-wrap20(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1734)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6688)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
作为用户的反馈,此错误仅在应用程序处于后台并且没有与之交互时发生,我认为问题在于三星的设备rom尝试最小化后台任务或将其置于特殊内存中的方式我们的应用尚未准备就绪,这种情况发生了。
关键是异常并未指向应用程序的任何类,因此我们可以跟踪问题,如果有人在遇到此问题之前请求帮助!
答案 0 :(得分:0)
尝试这个..它的工作对我来说,我在不同的设备上有同样的问题
将compile 'com.android.support:multidex:1.0.1'
添加到您的依赖项。
确保将multiDexEnabled true
放入defaultConfig
然后在Application类中添加它
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
答案 1 :(得分:0)