Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ServiceUtils isServiceRunning 部分机型抛出 android.os.DeadSystemException #1291

Open
xuhaoyang opened this issue Aug 3, 2020 · 1 comment
Assignees
Labels
bug

Comments

@xuhaoyang
Copy link

@xuhaoyang xuhaoyang commented Aug 3, 2020

描述 Bug

简洁地描述下 Bug。

  • AndroidUtilCode 的版本:所有版本(到1.29.0)
  • 出现 Bug 的设备型号:samsung SM-G960F(s9) / samsung Note9还有其他机型 未统计
  • 设备的 Android 版本:Android 9

相关代码

ServiceUtils.isServiceRunning(xxxx.class.getName())

异常堆栈

android.os.DeadSystemException
 Caused by: java.lang.RuntimeException: android.os.DeadSystemException
	at android.app.ActivityManager.getRunningServices(ActivityManager.java:2696)
	at xxxx.ServiceUtils.isServiceRunning(SourceFile:2)
	at xxxxx.xxxxx$x.handleMessage(SourceFile:5)
	at android.os.Handler.dispatchMessage(Handler.java:107)
	at android.os.Looper.loop(Looper.java:237)
	at android.app.ActivityThread.main(ActivityThread.java:8125)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)

截图

如果有的话请添加屏幕截图以帮助解释问题。

处理建议

建议catch 这类错误 避免应用crash

@Blankj
Copy link
Owner

@Blankj Blankj commented Sep 7, 2020

下版本加 catch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.