DeadSystemException start service Android 7

stankocken picture stankocken · Jun 7, 2017 · Viewed 8.6k times · Source

For the past few weeks, I have on my crash reporter:

Fatal Exception: java.lang.RuntimeException: Unable to start service com.####.MyService@ef705d8 with Intent { act=HIDE cmp=com.####/.MyService (has extras) }: java.lang.RuntimeException: android.os.DeadSystemException
       at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3344)
       at android.app.ActivityThread.-wrap21(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1583)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6121)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)

This crash is present on:

  • all Samsung devices 7.0

  • all Nexus devices on 7.1.2

Note:

  • It is not due to a recent update of our application, just an OS updates on theses phones.

  • It is a very very frequent crashes (by far our biggest).

  • Our users don't report crashes than before (is this crash actually visible for the user?)

  • We are not able to reproduce it on our side

  • As you can see into the stack trace, the code impacted is system only. Not much I can do from my side to try and catch and handle the issue.

I checked the thread Android DeadSystemException but that doesn't help me much.

I know that DeadSystemException is:

The core Android system has died and is going through a runtime restart. All running apps will be promptly killed.

Is there anything we can do but to say "that's system, we cannot do anything"?

Answer

Zoe picture Zoe · Jun 7, 2017

When the device is being restarted, you cannot run an app. Any app, not just yours but any given app cannot run when the device is restarting. AFAIK it occurs when you try to do something when the system crashes. Meaning if the system crashes and as it restarts your app starts a service or does something you get that error.

Meaning the exception is not connected to your app, but the Android OS and there is nothing you can do about it.

The crash being related to starting a service is because that is what your app did when the system crashed.

So: The error is something the system threw because your app did something when the system did a run-time reboot. There is nothing you can do about this, as you cannot control the Android OS from an app.