Android crashes after update project to Unity 2020.3.9f

Hello. I've got many crash reports after update projects to Unity 2020.3.9f1 on android! Same situation with 2021.1.7f1.
I can't reproduce this on my devices.

this is report from firebase crashlytics:

Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'void com.unity3d.player.f.a(android.view.SurfaceView)' on a null object reference
       at com.unity3d.player.UnityPlayer$19.surfaceDestroyed()
       at android.view.SurfaceView.updateWindow(SurfaceView.java:687)
       at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:284)
       at android.view.View.dispatchDetachedFromWindow(View.java:15618)
       at android.view.ViewGroup.removeAllViewsInLayout(ViewGroup.java:5085)
       at android.view.ViewGroup.removeAllViews(ViewGroup.java:5031)
       at com.unity3d.player.UnityPlayer.destroy()
       at com.unity3d.player.UnityPlayerActivity.onDestroy(UnityPlayerActivity.java:68)
       at android.app.Activity.performDestroy(Activity.java:6868)
       at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1153)
       at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4285)
       at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4316)
       at android.app.ActivityThread.-wrap6(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1588)
       at android.os.Handler.dispatchMessage(Handler.java:110)
       at android.os.Looper.loop(Looper.java:203)
       at android.app.ActivityThread.main(ActivityThread.java:6251)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)

also I can see same reports from Google Play Console.
there are not specific devices or regions or device state of ram or free storage that points to hint where crash occurs.
projects are using last firebase, google ads and facebook plugins
pls help!

1 Like

We’re also seeing this exact issue. I don’t have much further info except we do have one video report from a beta tester that shows the following:

  • The user closes the game via in-game button (which calls Application.Quit)
  • The application closes, device home screen shows for ~2 seconds
  • The crash occurs

We’re using Unity 2020.3.11f1. We recently upgraded from 2019.4.16f1 and did not see this crash before the upgrade

4 Likes

im using Unity 2020.3.9f1 and have same issue.any help?

1 Like

I found something. All errors occur only in the armeabi-v7a library. There are no reports from devices using the arm64-v8a library. Checked all reports from Firebase Crashlytics and Google Play Vitals.

It also looks like this is a similar issue from another thread: https://discussions.unity.com/t/842620
But there the error comes from both libraries and when creating the surface

2 Likes

i found the solution.I’ve discovered that Nox Player can reproduce this error when calling Application.Quit().
so i try to create a plugin to extend UnityPlayerActivity and override onDestroy() funtion

@Override protected void onDestroy ()
{
     mUnityPlayer.removeAllViews();
     mUnityPlayer.quit();
     super.onDestroy();
}

after that,I no longer get that error on Nox Player

1 Like

We also experiencing a surge of this crashes with upgrade to unity 2020.3.12f1, which is happening after Application.Quit() and possibly when app gets killed in background on some devices.
Did anyone find a viable solution besides creating a plugin and overriding UnityPlayerActivity?

2 Likes

Can you share this plugin/library with us? I also want to test it, but I don’t have “Nox Player”.

We’re preparing a build for a small staged rollout in which we’ve changed the android behaviour to move the app to the background rather than quitting. It’s not ideal but the app closes and the player can swipe it away from the background to close it manually.

We’re not sure if the crash is occurring when the app is killed in background by the system (as @nuounity ) suggested it may, but this “fix” will likely not help much if that’s the case.

I’ll post the code below and update this thread once we’ve got some results back as to whether the change helps the crash report numbers

using (var unityPlayerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
{
    using (var activity = unityPlayerClass.GetStatic<AndroidJavaObject>("currentActivity"))
    {
        activity.Call<bool>("moveTaskToBack", new object[] { true });
    }
}

NoxPlayer is free,u can google it.
This is my plugin,Unity forum not allow to upload aar file so after download,make sure you rename it to .aar
You can use my plugin because it very simple,only override onDestroy on UnityPlayerActivity and nothing else
Put this .arr file to Plugins/Android,and make sure you set

activity android:name="com.HD43.CUL.UnityPlayerActivity"

on yout AndroidManifest (dont worry,it not change your final package name)
after use this solution,I no longer see this error on firebase reports

7284526–880705–app-release.aar.txt (33.6 KB)

3 Likes

I tried this code instead of Application.Quit, and the issue stil occurs.

Edit: Disregard my comment below, report numbers seem to have dropped but we’re definitely still getting crash reports come through.

Just reporting back to confirm the “fix” I mentioned above has seemed to completely prevent the crash being reported in our project, despite it not working for @Shefich . Hopefully this may be useful to someone else.

Either way, lets hope Unity can diagnose the problem and get a fix out soon for 2020 LTS

Lots and Lots of the same crash here.
Unity 2020.3.12f1

java.lang.Error: FATAL EXCEPTION [main]
Unity version : 2020.3.12f1

Caused by
at android.app.ActivityThread.performDestroyActivity (ActivityThread.java:5061)
at android.app.ActivityThread.handleDestroyActivity (ActivityThread.java:5084)
at android.app.ActivityThread.access$1700 (ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1853)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:158)
at android.app.ActivityThread.main (ActivityThread.java:7224)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)
Caused by: java.lang.NullPointerException:
at com.unity3d.player.UnityPlayer$19.surfaceDestroyed (UnityPlayer.java)
at android.view.SurfaceView.updateWindow (SurfaceView.java:696)
at android.view.SurfaceView.onWindowVisibilityChanged (SurfaceView.java:316)
at android.view.View.dispatchDetachedFromWindow (View.java:15842)
at android.view.ViewGroup.removeAllViewsInLayout (ViewGroup.java:5138)
at android.view.ViewGroup.removeAllViews (ViewGroup.java:5084)
at com.unity3d.player.UnityPlayer.destroy (UnityPlayer.java)
at com.unity3d.player.UnityPlayerActivity.onDestroy (UnityPlayerActivity.java:68)
at android.app.Activity.performDestroy (Activity.java:7102)
at android.app.Instrumentation.callActivityOnDestroy (Instrumentation.java:1170)
at android.app.ActivityThread.performDestroyActivity (ActivityThread.java:5039)
at android.app.ActivityThread.handleDestroyActivity (ActivityThread.java:5084)
at android.app.ActivityThread.access$1700 (ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1853)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:158)
at android.app.ActivityThread.main (ActivityThread.java:7224)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)

Hi all. Have same problem after updating from Unity 2018.4.23 to Unity 2020.4.3.
Planned to update to 2020.3.12, because it release notes it says that the Applicatio.Quit crash has been fixed. But @Zeeppo-Games said that they have same issue on that version.
So what to do?

Crash stacktrace,

This is my override Acctivity

Caused by java.lang.RuntimeException: Unable to destroy activity {com../com...OverrideUnityActivity}: java.lang.NullPointerException: Attempt to invoke virtual method ‘void com.unity3d.player.f.a(android.view.SurfaceView)’ on a null object reference
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5145)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5168)
at android.app.ActivityThread.access$1700(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1880)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7406)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

And also the default one

Caused by java.lang.NullPointerException: Attempt to invoke virtual method ‘void com.unity3d.player.f.a(android.view.SurfaceView)’ on a null object reference
at com.unity3d.player.UnityPlayer$19.surfaceDestroyed()
at android.view.SurfaceView.updateWindow(SurfaceView.java:695)
at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:322)
at android.view.View.dispatchDetachedFromWindow(View.java:15912)
at android.view.ViewGroup.removeAllViewsInLayout(ViewGroup.java:5141)
at android.view.ViewGroup.removeAllViews(ViewGroup.java:5087)
at com.unity3d.player.UnityPlayer.destroy()
at com.unity3d.player.UnityPlayerActivity.onDestroy(UnityPlayerActivity.java:68)
at android.app.Activity.performDestroy(Activity.java:7130)
at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1171)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5123)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5168)
at android.app.ActivityThread.access$1700(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1880)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7406)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

I’m using Unity 2019.4.28f1 and have same issue. Any progress on this issue?

Same problem here.
Using Unity 2020.3.4f1.

Receiving bunch of reports of errores of this kind:

java.lang.Error: FATAL EXCEPTION [main]
Unity version : 2020.3.4f1
Device model : samsung SM-G610M
Device fingerprint: samsung/on7xelteub/on7xelte:7.0/NRD90M/G610MUBS1BRF3:user/release-keys
Build Type : Release
Scripting Backend : IL2CPP
ABI : armeabi-v7a
Strip Engine Code : true
Caused by
at android.app.ActivityThread.performDestroyActivity (ActivityThread.java:4634)
at android.app.ActivityThread.handleDestroyActivity (ActivityThread.java:4661)
at android.app.ActivityThread.-wrap7 (ActivityThread.java)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1703)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:154)
at android.app.ActivityThread.main (ActivityThread.java:6776)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1518)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1408)
Caused by: java.lang.NullPointerException:
at com.unity3d.player.UnityPlayer$19.surfaceDestroyed (Unknown Source)
at android.view.SurfaceView.updateWindow (SurfaceView.java:640)
at android.view.SurfaceView.onWindowVisibilityChanged (SurfaceView.java:266)
at android.view.View.dispatchDetachedFromWindow (View.java:16760)
at android.view.ViewGroup.removeAllViewsInLayout (ViewGroup.java:5153)
at android.view.ViewGroup.removeAllViews (ViewGroup.java:5099)
at com.unity3d.player.UnityPlayer.destroy (Unknown Source)
at com.unity3d.player.UnityPlayerActivity.onDestroy (UnityPlayerActivity.java:68)
at android.app.Activity.performDestroy (Activity.java:7223)
at android.app.Instrumentation.callActivityOnDestroy (Instrumentation.java:1161)
at android.app.ActivityThread.performDestroyActivity (ActivityThread.java:4621)

java.lang.Error: FATAL EXCEPTION [main]
Unity version : 2021.1.14f1
Device model : samsung SM-G610M
Device fingerprint: samsung/on7xelteub/on7xelte:7.0/NRD90M/G610MUBS1BRF3:user/release-keys
Build Type : Release
Scripting Backend : IL2CPP
ABI : armeabi-v7a
Strip Engine Code : true

Caused by
at android.view.ViewGroup.addViewInner (ViewGroup.java:4658)
at android.view.ViewGroup.addView (ViewGroup.java:4499)
at android.view.ViewGroup.addView (ViewGroup.java:4439)
at android.view.ViewGroup.addView (ViewGroup.java:4412)
at com.unity3d.player.f.a (f.java)
at com.unity3d.player.UnityPlayer$19.surfaceCreated (UnityPlayer.java)
at android.view.SurfaceView.updateWindow (SurfaceView.java:656)
at android.view.SurfaceView.onWindowVisibilityChanged (SurfaceView.java:266)
at android.view.View.dispatchWindowVisibilityChanged (View.java:11139)
at android.view.ViewGroup.dispatchWindowVisibilityChanged (ViewGroup.java:1290)
at android.view.ViewGroup.dispatchWindowVisibilityChanged (ViewGroup.java:1290)
at android.view.ViewGroup.dispatchWindowVisibilityChanged (ViewGroup.java:1290)
at android.view.ViewGroup.dispatchWindowVisibilityChanged (ViewGroup.java:1290)
at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:1842)
at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1537)
at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:7183)
at android.view.Choreographer$CallbackRecord.run (Choreographer.java:959)
at android.view.Choreographer.doCallbacks (Choreographer.java:734)
at android.view.Choreographer.doFrame (Choreographer.java:670)
at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:945)
at android.os.Handler.handleCallback (Handler.java:751)
at android.os.Handler.dispatchMessage (Handler.java:95)
at android.os.Looper.loop (Looper.java:154)
at android.app.ActivityThread.main (ActivityThread.java:6776)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1518)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1408)

I can now also confirm that upgrading to unity 2020.3.13f1 does not fix the crash despite the 2020.3.12 release notes mentioning they fixed a crash related to Application.Quit() on android.
The issue linked in the release notes is actually a separate problem about a seg fault.

No fix in 2020.3.14f released yesterday.

Unbelievable

1 Like

Hey i have downgraded to Unity 2020.3.3, and problem gone. now waiting for fix, most likely on 2020.3.15.

Is there any issue created for this crash? Or any place we can vote? I didn’t see any related pages like this one neither in the forums nor in the issues pages.