Androidstudio 报错日志:Launcher does not have the permission to launch Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.x.x.x/com.x.x.x.MainActivity bnds=[838,1266][1006,1434] (has extras) }. Make sure to create a MAIN intent-filter for the corresponding activity or use the exported attribute for this activity.
问题:两台安卓测试机,安装APK后,一个可以运行,一个不能运行
根据建议:
1.Make sure to create a MAIN intent-filter for the corresponding activity
2.Use the exported attribute for this activity(我这次无法运行的原因,所以解释第2点)
<activity android:name=".MainActivity" android:exported="true">// 重点是 android:exported 这个特性要为true 就可以运行了
Android 的安全策略要求应用程序在默认情况下将 android:exported 属性设置为 false,这样可以确保应用程序组件仅供应用程序内部使用,并且不会被其他应用程序访问或启动。但是,某些手机制造商可能对 Android 系统进行了修改,并对权限和安全策略进行了调整。这可能导致在某些手机上需要将 android:exported 属性设置为 true 才能让应用程序正常工作。