Quantcast
Channel: Questions in topic: "crash"
Viewing all articles
Browse latest Browse all 2383

Crash in onDestroy, when set android:launchMode="singleTop"

$
0
0
Video ads are automatically turned off when the game switches to the background on android devices. So I set launchMode to singleTop。And add the code in UnityPlayerActivity.java onCreate function: ---------- @Override protected void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); if (UnityPlayer.currentActivity != null) { finish(); return; } String cmdLine = updateUnityCommandLineArguments(getIntent().getStringExtra("unity")); getIntent().putExtra("unity", cmdLine); mUnityPlayer = new UnityPlayer(this, this); setContentView(mUnityPlayer); mUnityPlayer.requestFocus(); } ---------- then I get some crash. The crash report is: ---------- Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.FrameLayout.removeAllViews()' on a null object reference at com.unity3d.player.UnityPlayerActivity.onDestroy(UnityPlayerActivity.java:1) at android.app.Activity.performDestroy(Activity.java:7684) at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1306) at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4693) at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4731) at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:39) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1948) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7050) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)

Viewing all articles
Browse latest Browse all 2383

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>