5.0上java.lang.IllegalArgumentException: Service Intent must be explicit异常
来源:互联网 发布:fifa online 3软件 编辑:程序博客网 时间:2024/06/02 02:31
Service启动的方式有两种:显式启动、隐式启动。
隐式启动
<service android:name=".service"> <intent-filer> <action android:name="com.android.service"/> <intent-filer></service>
final Intent serviceIntent=new Intent();
serviceIntent.setAction("com.android.service");
显示启动
final Intent serviceIntent=new Intent(this,service.class);
startService(serviceIntent);
如果在同一个包中。两者都可以用。在不同包时。只能用隐式启动。
需要注意的是在5.0上采用隐式启动时,会出现java.lang.IllegalArgumentException: Service Intent must be explicit异常。也就是说Service的Intent必须明确。
解决方法就是给Intent设置一下具体的包名,指明具体是哪个包启动的Service。
intent.setPackage("com.android.vending")
0 0
- 5.0上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 {
- 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解决方法
- 20_ 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隐式意图找不到错误解决
- Android5.0报错:java.lang.IllegalArgumentException: Service Intent must be explicit
- http://snap.stanford.edu/data/index.html
- com.ibatis.common.jdbc.exception.NestedSQLException:
- linux 进程通信之 信号
- CSDN学院 免费技术答疑公开课,本周六场即将开播~~~
- SSH框架快速搭建
- 5.0上java.lang.IllegalArgumentException: Service Intent must be explicit异常
- 生活灵感汇总
- Mysql 性能监控及调优
- 20150803-STVD中报“ERROR:before starting debug session,please,select a target”错误
- binary search
- IOS 定制中间突出UItabBar
- sphinx 指定字段内容 高亮
- Android studio 打包apk如何重命名apk名称
- linux服务器查看公网IP