Android应用停止运行处理策略(如 DeadSystemException)

Android应用停止运行处理策略- https://www.jianshu.com/p/c3da4681a19b
Android DeadSystemException- https://stackoverflow.com/questions/42784731/android-deadsystemexception
Android DeadSystemException- https://www.e-learn.cn/content/wangluowenzhang/189851
>  android.os.DeadSystemException:The core Android system has died and is going through a runtime restart. All running apps will be promptly killed.
1. android.os.DeadSystemException, 好像是说Android核心系统挂了,看了日志下日志,
解析原始
 java.lang.RuntimeException:android.os.DeadSystemException
 android.app.ContextImpl.checkPermission(ContextImpl.java:1664)
 ......
 Caused by:
 android.os.DeadSystemException:
 android.app.ContextImpl.checkPermission(ContextImpl.java:1664)
 android.app.ContextImpl.checkSelfPermission(ContextImpl.java:1712)
 android.content.ContextWrapper.checkSelfPermission(ContextWrapper.java:750)
 com.baidu.trace.c.e.e(Unknown Source)
 com.baidu.trace.ar.a(Unknown Source)
 com.baidu.trace.bd$b.run(Unknown Source)
 android.os.Handler.handleCallback(Handler.java:751)
 android.os.Handler.dispatchMessage(Handler.java:95)
 android.os.Looper.loop(Looper.java:154)
 com.baidu.trace.bd.run(Unknown Source)

android.os.DeadSystemException现在普遍发生在Android7.0上,是由android os抛出来的,一般是启动服务的时候catch到了异常,结果又抛出了一个新的异常,源码如下:
public RuntimeException rethrowFromSystemServer() {
        if (this instanceof DeadObjectException) {
            throw new RuntimeException(new DeadSystemException());
        } else {
            throw new RuntimeException(this);

        }

    }
暂时来看我们是什么都做不了。
可以的规避方案是:catch该exception,然后看下鹰眼服务是否启动了,若未启动则再次启动 

2. Android DeadSystemException
Currently we are experiencing a DeadSystemException in our HockeyApp crash reporting. It occures on Android 7.0 and Android 7.1. We don't experience this exception in previous version of our application (they are currently both used by users), so I guess this exception is caused by some code change. But stack trace is not wery helpful for this. Any idea? Thanks for any sugestion.

  Stack trace from HockeyApp:
java.lang.RuntimeException: android.os.DeadSystemException
at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3781)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: android.os.DeadSystemException

-- 涉及到Android系统API的空指针问题,使用try...catch规避问题.

你可能感兴趣的:(性能优化与测试)