http://bbs.coloros.com/thread-174655-1-1.html

急!!Service在OPPO系列手机下无法启动,寻求帮助

你好,我是网易邮件事业部1元夺宝开发工程师,最近三个版本发现一个崩溃很怪异,因为97%的奔溃都发生在OPPO机型,而且OPPO机型里85%是R7系列,以下是错误日志,麻烦童鞋们帮忙看看,谢谢! Fatal Exception: java.lang.RuntimeException: An error occured while executing doInBackground() at com.netease.mail.oneduobaohydrid.base.BaseAsyncTask$3.done(BaseAsyncTask.java:95) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) at java.util.concurrent.FutureTask.setException(FutureTask.java:222) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1115) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:590) at java.lang.Thread.run(Thread.java:818) Caused by java.lang.SecurityException: Unable to start service Intent { cmp=com.netease.mail.oneduobaohydrid/.service.OneService }: Unable to launch app com.netease.mail.oneduobaohydrid/10057 for service Intent { cmp=com.netease.mail.oneduobaohydrid/.service.OneService }: user 0 is restricted at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1769) at android.app.ContextImpl.startService(ContextImpl.java:1742) at android.content.ContextWrapper.startService(ContextWrapper.java:527) at com.netease.mail.oneduobaohydrid.service.OneService.start(OneService.java:102) at com.netease.mail.oneduobaohydrid.OneApplication.init(OneApplication.java:207) at com.netease.mail.oneduobaohydrid.base.BaseApplication$1.doInBackground(BaseApplication.java:84) at com.netease.mail.oneduobaohydrid.base.BaseApplication$1.doInBackground(BaseApplication.java:75) at com.netease.mail.oneduobaohydrid.base.BaseAsyncTask$2.call(BaseAsyncTask.java:83) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1115) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:590) at java.lang.Thread.run(Thread.java:818)

你好,我们工程师看了一下,提出了一些问题:

OPPO手机内置有耗电管理的功能,可能该应用服务在后台启动时被判断为耗电的一种操作行为;
但是根据你的上面提交的资料,这个问题没有详细完整的Log或复现路径,不知道该应用是被OPPO手机内的耗电管理判断是哪种类型耗电,所以暂时无法提供方法。 
理论上如果该应用服务是合理地使用就不会被判断耗电。 
所以希望有完整的log以及复现路径提供给我们。

另一种方法是,你们可以尝试自己在启动服务时捕获异常,不上报,因为OPPO手机内对耗电管理的限制对他们的正常使用没有影响。

请问跟 APP 使用了 multi-dex 有关系么?
你们的 rom,启用了 ART 虚拟机么?

解决方法:

@ALL ,不好意思让大家久等了。
经过和OPPO工程师沟通,这个问题的原因是OPPO手机自动熄屏一段时间后,会启用系统自带的电量优化管理,禁止一切自启动的APP(用户设置的自启动白名单除外)。

所以,类似的崩溃常常集中在用户休息之后的夜里或者凌晨,但是并不影响用户平时的正常使用。

至于会出现user 0 is restricted,我觉得是coloros系统电量优化管理做得不好的地方。

对coloros官方的处理建议:既然禁止自启动,那么干脆直接force stop对应的进程,而不是抛出RuntimeException来让开发者买单。

对开发者处理建议:在服务启动的地方进行try catch防止崩溃即可(也是“1元夺宝”APP目前的处理方式)

bug--service--Caused by java.lang.SecurityException: Unable to start service Intent { }:user 0 is restricted的更多相关文章

  1. Android异常:唤醒锁未授权。(Caused by: java.lang.SecurityException: Neither user 10044 nor current process has android.permission.WAKE_LOCK.)

    Android异常:Caused by: java.lang.SecurityException: Neither user 10044 nor current process has android ...

  2. hive Caused by: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient

    Exception in thread "main" java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata. ...

  3. Caused by: java.lang.IllegalStateException: Unable to complete the scan for annotations for web application [/Cppcc] due to a StackOverflowError. Possible root causes include a too low setting for -Xs

    解决办法:(1)修改D:\Java\apache-tomcat-7.0.88\conf\catalina.properties (122line) (2)如org.apache.catalina.st ...

  4. tomcat启动时检测到循环继承而栈溢出的问题:Caused by: java.lang.IllegalStateException: Unable to complete the scan for annotations for web application [/test] due to a StackOverflowError. Possible root causes include

    最近在公司更新一个老项目的时候,发现部署项目后tomcat报错,错误如下: Caused by: java.lang.IllegalStateException: Unable to complete ...

  5. 【异常】Caused by: java.lang.IllegalStateException: RequestParam.value() was empty on parameter 0

    使用@RequestParam注解,必须指定名称如: @RequestParam("date")String date

  6. 我的Android进阶之旅------>解决DownloadManager报错java.lang.SecurityException: Invalid value for visibility: 2

    1.问题描述 今天使用Android系统的DownloadManager进行下载操作时,爆了如下所示的错误: java.lang.RuntimeException: Unable to start s ...

  7. 转:android DownloadManager: java.lang.SecurityException: Invalid value for visibility: 2

    1.问题描述 今天使用Android系统的DownloadManager进行下载操作时,爆了如下所示的错误: java.lang.RuntimeException: Unable to start s ...

  8. 编译异常 Caused by: java.lang.UnsupportedClassVersionError:

    Caused by: java.lang.UnsupportedClassVersionError: com/sumingk/platform/service/impl/ServiceSysPerso ...

  9. Caused by: java.lang.ClassNotFoundException: ognl.PropertyAccessor

    1.错误描述 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ] { -help ...

随机推荐

  1. 调用接口传递的XML 及排查原因

    2fq3ej15nv8fgns30firbqtlo3 <Interface type="edit" model="object" value=" ...

  2. WebMidiLink

    g200kg > WebMidiLink > 1.Introduction WebMidiLink 2012/06/26 1.Introduction « Prev 1.Introduct ...

  3. 常用的CSS Hack

    一.什么是CSS Hack? 不同的浏览器对CSS的解析结果是不同的,因此会导致相同的CSS输出的页面效果不同,这就需要CSS Hack来解决浏览器局部的兼容性问题.而这个针对不同的浏览器写不同的CS ...

  4. android插件中或者library中获取asstes文件

    在插件中或者library的项目中把文件放在asstes,不能用context.getResources().getAssets().open(fileName)读取到流,会报FileNotFound ...

  5. storyboard tabbarcontroller设置tab的图片

    在storyboard里逐项设置了图片,咦,怎么是颜色?别急,慢慢来 找到你的tabbarcontroller指向的viewcontroller,在viewdidload里做如下事,搞定 - (voi ...

  6. thinkphp在模型中自动完成session赋值

    相信用过thinkphp的用户都知道thinkphp的模型可以完成很多辅助功能,比 如自动验证.自动完成等,今天在开发中遇到自动完成中需要获取session值 然后自动赋值的功能,具体看代码:clas ...

  7. Angular2学习之开发环境构建

    一.主要资料 http://blog.csdn.net/cz_jjq/article/details/50425206 http://www.tuicool.com/articles/mi6rmuB ...

  8. 偶然翻出很久很久以前写的一款sqlmap UI,有点年头了

  9. Spring+SpringMVC+Mybatis大整合(SpringMVC采用REST风格、mybatis采用Mapper代理)

    整体目录结构: 其中包下全部是采用mybatis自动生成工具生成. mybatis自动生成文件 <?xml version="1.0" encoding="UTF- ...

  10. edgesForExtendedLayout,automaticallyAdjustsScrollViewInsets, extendedLayoutIncludesOpaqueBars的影响

    在IOS7以后 ViewController 开始使用全屏布局的,而且是默认的行为通常涉及到布局 就离不开这个属性 edgesForExtendedLayout,它是一个类型为UIExtendedEd ...