解决unity 打包在Android 8.0上启动出现黑屏问题


我的项目使用unity5.4.1开发,在Android8.0的时候启动会出现黑屏,同时发现日志中有这一句日志Unable to query for permission: Fragment null must be a public static class to be properly recreated from instance state,经过各种百度Google之后,发现在不升级unity版本的情况下有三种解决办法:

1.在AndroidManifest.xml中加入:

解决unity 打包在Android 8.0上启动出现黑屏问题(Android权限弹窗问题)解决unity 打包在Android 8.0上启动出现黑屏问题_android


2.在AndroidManifest.xml的Activity节点下加上:

解决unity 打包在Android 8.0上启动出现黑屏问题(Android权限弹窗问题)解决unity 打包在Android 8.0上启动出现黑屏问题_Google_02

<meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="true" />

3.新建一个入口activity,动态获取权限成功后,再跳转到UnityPlayerActivity
我使用的是第二种办法,我觉得最好升级到unity到5.6之后,因为官方已经修复了这个bug
​​​https://forum.unity.com/threads/game-does-not-work-on-new-android-oreo.490142/page-3​