android 点击快捷方式提示未安装程序的解决

来源:互联网 发布:python input一个元组 编辑:程序博客网 时间:2024/05/24 04:37

最近APP出现一个很奇怪的问题,在Android 4.4.2和android 4.4.3系统上点击应用的快捷方式,打不开应用,而且会提示未安装程序。

确认了应用的MainActivity中设置了android.intent.action.MAIN,添加了INSTALL_SHORTCUT的权限,并且快捷方式的Intent是指向正确的Activity,原因就一直没找到。后来分析了一下在点击快捷方式时的log,发现了这么一句:

[plain] view plain copy
  1. W/ActivityManager(  770): Permission Denial: starting Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.dudaogame.gamecenter/.MainActivity bnds=[14,423][266,738] } from ProcessRecord{4389cfe8 1293:com.sec.android.app.launcher/u0a9} (pid=1293, uid=10009) not exported from uid 10242  

log的意思是说不能app的进程不能被其他进程(这里指的是com.sec.android.app.launcher,即手机的launcher应用)调用。解决方法就是在MainActivity的属性中添加exported="true"。
阅读全文
0 0
原创粉丝点击