当前位置: 首页>移动开发>正文

Unity 打Apk包在小米设备中安装失败,错误代码-108

问题:

unity 打包后,在其它设备正常,在Android 12系统中安装失败,显示错误代码 108。

解决办法:

翻译成通俗的语言就是说,当你的AndroidManifest.xml中文件中,如果存在Activity,Receiver,Service使用到了标签,则是要显示声明android:exported的值

大部分常规设置为android:exported="false"即可,如下面一个简单的例子:

<service android:name="com.example.app.backgroundService"
         android:exported="false">
         <intent-filter>
         	<action android:name="com.example.app.START_BACKGROUND" />
         </intent-filter>
</service>

注意:在unity中,最好把exported = “false” 改成 true ,否者“Build And Run”会报错

Exception occurred while executing 'start': java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.Company.test/com.unity3d.player.UnityPlayerActivity } from null (pid=16988, uid=2000) not exported from uid 10255

参考:

https://stars-one.site/2022/11/22/android12-install-108

https://blog.csdn.net/adayabetter/article/details/75037606


https://www.xamrdz.com/mobile/4w71848767.html

相关文章: