android系统服务分析,源码分析Android系统后台应用启动服务crash

源码分析Android系统后台应用启动服务crash

有的时候表面上看起来似乎一切运行正常,但是通过查看日志发现是有问题的。

下面这段日志,截取自某设备开机过程的日志。通过查看,发现有GMS的crash。

--------- beginning of crash

03-09 03:46:43.183 3804 3804 E AndroidRuntime: FATAL EXCEPTION: main

03-09 03:46:43.183 3804 3804 E AndroidRuntime: Process: com.google.android.gms.persistent, PID: 3804

03-09 03:46:43.183 3804 3804 E AndroidRuntime: java.lang.RuntimeException: Unable to start receiver com.google.android.gms.chimera.GmsIntentOperationService$PersistentTrustedReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { act=android.intent.action.LOCKED_BOOT_COMPLETED flg=0x9000010 cmp=com.google.android.gms/.chimera.GmsIntentOperationService (has extras) }: app is in background uid UidRecord{bf88dc8 u0a10 RCVR idle change:uncached procs:2 seq(0,0,0)}

03-09 03:46:43.183 3804 3804 E AndroidRuntime: at android.app.ActivityThread.handleReceiver(ActivityThread.java:3388)

03-09 03:46:43.183 3804 3804 E AndroidRuntime: at android.app.ActivityThread.access$1200(ActivityThread.java:199)

03-09 03:46:43.183 3804 3804 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)

03-09 03:46:43.183 3804 3804 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)

03-09 03:46:43.183 3804 3804 E AndroidRuntime: at android.os.Looper.loop(Looper.java:193)

03-09 03:46:43.183 3804 3804 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6669)

03-09 03:46:43.183 3804 3804 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)

03-09 03:46:43.183 3804 3804 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)

03-09 03:46:43.183 3804 3804 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:866)

03-09 03:46:43.183 3804 3804 E AndroidRuntime: Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { act=android.intent.action.LOCKED_BOOT_COMPLETED flg=0x9000010 cmp=com.google.android.gms/.chimera.GmsIntentOperationService (has extras) }: app is in background uid UidRecord{bf88dc8 u0a10 RCVR idle change:uncached procs:2 seq(0,0,0)}

03-09 03:46:43.183 3804 3804 E AndroidRuntime: at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1577)

03-09 03:46:43.183 3804 3804 E AndroidRuntime: at android.app.ContextImpl.startService(ContextImpl.java:1532)

03-09 03:46:43.183 3804 3804 E AndroidRuntime: at android.content.ContextWrapper.startService(ContextWrapper.java:664)

03-09 03:46:43.183 3804 3804 E AndroidRuntime: at iap.startService(:com.google.android.gms@19831064@19.8.31 (080306-284611645):3)

03-09 03:46:43.183 3804 3804 E AndroidRuntime: at android.content.ContextWrapper.startService(ContextWrapper.java:664)

03-09 03:46:43.183 3804 3804 E AndroidRuntime: at android.content.ContextWrapper.startService(ContextWrapper.java:664)

03-09 03:46:43.183 3804 3804 E AndroidRuntime: at android.content.ContextWrapper.startService(ContextWrapper.java:664)

03-09 03:46:43.183 3804 3804 E AndroidRuntime: at bkn.a(:com.google.android.gms@19831064@19.8.31 (080306-284611645):4)

03-09 03:46:43.183 3804 3804 E AndroidRuntime: at bkn.onReceive(:com.google.android.gms@19831064@19.8.31 (080306-284611645):7)

03-09 03:46:43.183 3804 3804 E AndroidRuntime: at gvr.onReceive(:com.google.android.gms@19831064@19.8.31 (080306-284611645):3)

03-09 03:46:43.183 3804 3804 E AndroidRuntime: at android.app.ActivityThread.handleReceiver(ActivityThread.java:3379)

03-09 03:46:43.183 3804 3804 E AndroidRuntime: ... 8 more

复制代码

下面,我们按照问题的解决顺序分析一下这题:

这是什么问题?

从源码的角度弄清楚产生问题的原因

找到解决方案

这是什么问题?

首先分析日志

--------- beginning of crash

复制代码

系统发生了crash

AndroidRuntime: Process: com.google.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值