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. 第七周——Linux内核如何装载和启动一个可执行程序

    万子惠 + 原创作品转载请注明出处 + <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 part1 实验 ...

  2. bs4 python解析html

    使用文档:https://www.crummy.com/software/BeautifulSoup/bs4/doc.zh/ python的编码问题比较恶心. decode解码encode编码 在文件 ...

  3. Launching the Debugger Automatically

    You can set up your application to start Visual Studio when you launch the application from Windows. ...

  4. 安装Fedora 24后必要的设置

    安装Fedora 24后必要的设置 导读 Fedora 是一个 Linux 发行版,是一款由全球社区爱好者构建的面向日常应用的快速.稳定.强大的操作系统.它允许任何人自由地使用.修改和重发布,无论现在 ...

  5. 105 董婷婷 第一次Sprint总结

    总结: 经过一个多星期,第一次Sprint在今天结束了,在这次Sprint中我们的工作主要做的是对项目的构建及各种界面的设计和完善,一些比较具体的功能还没有实现.在这次Sprint中因为有上学期合作的 ...

  6. CSS counter-reset 属性

    一.实例 对部分和子部分进行编号(比如 "Section 1"."1.1"."1.2")的方法: eg: css部分: ol { list- ...

  7. python 后台爆破工具(多线程)

    非阻塞 q.put(item) 写入队列,timeout等待时间 q.put_nowait(item) 相当q.put(item, False) threads多线程     首先导入threadin ...

  8. C++的深拷贝与浅拷贝

    对于普通类型的对象来说,它们之间的复制是很简单的,例如:int a=88;int b=a; 而类对象与普通对象不同,类对象内部结构一般较为复杂,存在各种成员变量.下面是一个类对象拷贝的简单例子. #i ...

  9. (转)AppiumLibrary基本操作

    *** Settings *** Library AppiumLibrary Library Collections Library String Library Dialogs *** Test C ...

  10. Quartus II 增量编译

    在开发阶段,经常需要改代码,而且往往只改局部代码,但是编译的时候,通常会全部重新编译,这会很浪费时间,使得开发效率大大降低.那么有没有一种方法能够降低不必要的编译时间呢?通过查询Quartus II ...