There's this weird exception in Samsung phones specifically Galaxy S7 Edge, which we noticed in Fabric crash reports:
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)
As a feedback from users, this error happens only when app is in the background and there's not interaction with it, I think the issue lies in the way Samsung's device rom tries to minimize background tasks or put them in a special memory and our app is not ready and this happens.
The point is the exception is not pointing to any class of the app so we can trace the issue, If anyone has encountered this problem before please help!
2 Answers
Answers 1
try this.. its work for me where i have the same problem on different devices
add compile 'com.android.support:multidex:1.0.1'
to your dependencies.
make sure you put multiDexEnabled true
in defaultConfig
then add this in your Application class
@Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this); }
Answers 2
From Marshmallow
, Google has introduced a new feature/mode called Doze
. According to official documents
Starting from Android 6.0 (API level 23), Android introduces two power-saving features that extend battery life for users by managing how apps behave when a device is not connected to a power source. Doze reduces battery consumption by deferring background CPU and network activity for apps when the device is unused for long periods of time. App Standby defers background network activity for apps with which the user has not recently interacted.
You can read it here in detail.
In Nougat
, it has been more optimized.
I believe the problem is actually the Doze
feature. I don't know if there's any way to prevent this, but you can manually do it. You can refer here and here for more detail
0 comments:
Post a Comment