美文网首页
Unity Bug修正: Fragment Instantiat

Unity Bug修正: Fragment Instantiat

作者: amosbake | 来源:发表于2018-04-25 19:51 被阅读103次

在产品发布后 在崩溃记录上经常有0.3%的崩溃记录
unity版本 5.6.2
Unable to start activity ComponentInfo{xxx/com.unity3d.player.UnityPlayerActivity}: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.unity3d.player.f$1: make sure class name exists, is public, and has an empty constructor that is public
caused by android.app.Fragment$InstantiationException
Unable to instantiate fragment com.unity3d.player.f$1: make sure class name exists, is public, and has an empty constructor that is public`

Caused by java.lang.IllegalAccessException java.lang.Class<com.unity3d.player.f$1> is not accessible from java.lang.Class<android.app.Fragment>

重现步骤:
打开开发者选项中的 不保留活动
重新安装游戏,等待权限弹窗出现
权限弹窗出现后 回到桌面 再从最近活动中进入游戏

解决方案:
继承UnityPlayerActivity 重写onCreate 方法

 public class YourActivity extends UnityPlayerActivity{

 @Override

protected void onCreate(Bundle context)) {

 super.onCreate(null);  }

在Manifest中 替换原有的UnityPlayerActivityYourActivity

相关文章

网友评论

      本文标题:Unity Bug修正: Fragment Instantiat

      本文链接:https://www.haomeiwen.com/subject/qfgylftx.html