美文网首页
Unable to start service Intent {

Unable to start service Intent {

作者: miniminiming | 来源:发表于2018-05-04 10:27 被阅读0次

05-04 10:17:00.593 1498-4738/? W/ActivityManager: Unable to start service Intent { cmp=/ming.com.faceunlock.FaceUnlockService launchParam=MultiScreenLaunchParams { mDisplayId=0 mFlags=0 } } U=0: not found

出错手机,三星S7edge
想写个Service,但是死活启动不起来,报这个错真是蛋疼

出错原因1

原本的写法:总是报这个错


image.png

改成这样就正常了。真是有趣的事情,这能说明java中this的指向有问题?或者说是三星的系统的问题?有时间再探究一下吧


image.png

出错原因2,居然还有第二种方式触发这个错误

想用远程来启动这个服务,但是总报错,启动不起来。
跟一个正常项目对比,最后发现问题出在setPackage这里。

在老的项目,像eclipse中开发安卓项目,识别应用的标志是包名,但是在AndroidStudio中,识别应用的标志是applicationId,而在这里,启动一个外部的Service,在setPackage时,应该设置为applicationid,而不是包名。shit,红框是我的项目包名,黄框是applicationid,改成后面就能正常启动了。


image.png

相关文章

网友评论

      本文标题:Unable to start service Intent {

      本文链接:https://www.haomeiwen.com/subject/egzrrftx.html