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

启动服务后无限停止运行 三星s8 9.0 #9

Open
2697a opened this issue Jul 8, 2019 · 6 comments
Open

启动服务后无限停止运行 三星s8 9.0 #9

2697a opened this issue Jul 8, 2019 · 6 comments

Comments

@2697a
Copy link

2697a commented Jul 8, 2019

java.lang.RuntimeException: Unable to start service com.shihoo.daemon.WatchDogService@d9f643d with Intent { cmp=com.meadding.shopping/com.shihoo.daemon.WatchDogService }: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Class.getName()' on a null object reference
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3904)
at android.app.ActivityThread.access$1700(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7045)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Class.getName()' on a null object reference
at com.shihoo.daemon.WatchDogService.onStart(WatchDogService.java:120)
at com.shihoo.daemon.WatchDogService.onStartCommand(WatchDogService.java:129)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3885)
at android.app.ActivityThread.access$1700(ActivityThread.java:237) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:214) 
at android.app.ActivityThread.main(ActivityThread.java:7045) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964) 

@2697a
Copy link
Author

2697a commented Jul 8, 2019

非常抱歉,我忘记修改包名了,sorroy

@ShihooWang
Copy link
Owner

没事,一般Unable to start service 的时候,需要检查下manifest中配置的是否有问题。

@2697a
Copy link
Author

2697a commented Jul 10, 2019

你好,部分手机上会遇到这种错误
Unable to stop service com.shihoo.daemon.PlayMusicService@292e357: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=包名/com.shihoo.daemon.PlayMusicService }: app is in background uid UidRecord

@ShihooWang
Copy link
Owner

你的目标API版本是不是大于26?
如果是,就需要适配Android O后台启动服务时,记着是APP在后台启动服务,需要在服务启动的5秒内调用
startForeground(int id, Notification notification)方法

@tianyu704
Copy link

@ShihooWang 目标api=28,总会提示无响应,每次出现都会出这个log
2019-12-03 14:36:39.455 25151-25162/com.shihoo.daemonlibrary I/o.daemonlibrar: Thread[7,tid=25162,WaitingInMainSignalCatcherLoop,Thread*=0x7367454400,peer=0x17a40330,"Signal Catcher"]: reacting to signal 3
2019-12-03 14:36:39.665 25151-25162/com.shihoo.daemonlibrary I/o.daemonlibrar: Wrote stack traces to tombstoned

@1025342523
Copy link

我也出现了这个问题怎么修改包名?

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

No branches or pull requests

4 participants