apk系列------app加service遇到的问题

问题1:在androidmanefist.xml加入service的定义之后出现了exported service does not require permission

回答: 你的service不需要权限设置,内部就可以调用,你把加的限制或者intent-filter去掉试试


问题2:apk安装进去之后遇到出错:PhoneFactory.getDefaultPhone must be called from Looper thread


回答:由于phone的包导错了,查看安卓源码其他apk的里面导入的包即可


问题3:包导对了之后发现遇到出错:java.lang.SecurityException: Not allowed to start service Intent { cmp=com.example.lisa/.Service1 } without permission not exported from uid 1000


回答:需要在manifest.xml里

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.lisa"
    android:versionCode="1"
    android:versionName="1.0" android:sharedUserId="android.uid.system">

<service android:name=".Service1"
           android:process="com.android.phone" 
            >  

AndroidManifest.xml 的
加上android:sharedUserId=”android.uid.system”
Activity属性添加:android:process="com.android.phone"


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值