java.lang.IllegalArgumentException: Service Intent must be explicit
来源:互联网 发布:ubuntu 打开jupyter 编辑:程序博客网 时间:2024/06/07 06:54
Android 5.0 手机上出现了崩溃:
AndroidRuntime: java.lang.RuntimeException: Unable to start receiver com.yulore.recognize.android.receiver.PhoneStateReceiver: java.lang.IllegalArgumentException: Service Intent must be explicit
经查询,原因是Android 5.0对Service Intent的调用策略发生改变了,必须通过显示Intent来启动Service,详细介绍可以看stackoverflow上的介绍。
解决办法如下:
1、通过显示意图启动Service(直接用类名);
- Intent intent = new Intent(com.yulore.test.AppService.class);
- context.startService(intent);
2、如果想继续使用隐式意图的话,加上包名信息即可;
- Intent intent = new Intent();
- intent.setAction("com.yulore.recognize.android");
- intent.setPackage(context.getPackageName()); //兼容Android 5.0
- context.startService(intent);
0 0
- java.lang.IllegalArgumentException: Service Intent must be explicit: Intent {
- java.lang.IllegalArgumentException: Service Intent must be explicit
- java.lang.IllegalArgumentException: Service Intent must be explicit
- java.lang.IllegalArgumentException: Service Intent must be explicit解决方法
- java.lang.IllegalArgumentException: Service Intent must be explicit异常说明
- Caused by: java.lang.IllegalArgumentException: Service Intent must be explicit:
- java.lang.IllegalArgumentException: Service Intent must be explicit
- java.lang.IllegalArgumentException: Service Intent must be explicit 异常说明
- java.lang.IllegalArgumentException: Service Intent must be explicit 异常解决
- java.lang.IllegalArgumentException: Service Intent must be explicit解决方法
- java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=xxx}
- java.lang.IllegalArgumentException:Service Intent must be explicit:Intent{act=org.opencv.engine.BIND
- Android报错:Caused by: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent
- 解决Android5.0及以上启动Service时,java.lang.IllegalArgumentException: Service Intent must be explicit
- android L java.lang.IllegalArgumentException: Service Intent must be explicit隐式意图找不到错误解决
- 5.0上java.lang.IllegalArgumentException: Service Intent must be explicit异常
- 20_ java.lang.IllegalArgumentException: Service Intent must be explicit异常说明
- Android5.0报错:java.lang.IllegalArgumentException: Service Intent must be explicit
- Struts2+Jquery+JSON 实现ajax注册信息
- cookie跨域
- 当继承AppCompatActivity使用侧滑时出现白色的问题
- Tableview中Dynamic Prototypes动态表的使用
- HashMap学习
- java.lang.IllegalArgumentException: Service Intent must be explicit
- php crypt in python
- PHP判断字符串是纯英文、纯汉字或汉英混合
- ToggleButton不显示
- ★nyoj304(好题)
- Prohibited package name: java.time
- Intellij下 把项目打包成可执行的jar
- 跨站脚本攻击XSS
- Spark中组件Mllib的学习1之Kmeans错误解决