在產(chǎn)品發(fā)布后 在崩潰記錄上經(jīng)常有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>
重現(xiàn)步驟:
打開開發(fā)者選項(xiàng)中的 不保留活動(dòng)
重新安裝游戲,等待權(quán)限彈窗出現(xiàn)
權(quán)限彈窗出現(xiàn)后 回到桌面 再?gòu)淖罱顒?dòng)中進(jìn)入游戲
解決方案:
繼承UnityPlayerActivity 重寫onCreate 方法
public class YourActivity extends UnityPlayerActivity{
@Override
protected void onCreate(Bundle context)) {
super.onCreate(null); }
在Manifest中 替換原有的UnityPlayerActivity 為 YourActivity