Search Issue Tracker

In Progress

Under Consideration for 2021.3.X, 2022.3.X

Votes

0

Found in

2021.3.38f1

2022.3.28f1

6000.0.1f1

Issue ID

UUM-71574

Regression

No

[Android] The Player crashes at "isInMultiWindowMode" when using lifecycle methods

--

-

Steps to reproduce:
1. Open the “LifecycleMethodsCrash” project
2. Go to Build Settings and make sure Export Project is enabled
3. Export the project
4. Open the exported project in Android Studio
5. Open the unityLibrary/java/com/unity3d/player/UnityPlayerActivity.java class and change the line {{mUnityPlayer = new UnityPlayer(this, this);}} to {{mUnityPlayer = new UnityPlayer(this.getApplicationContext(), this);}} in onCreate method
6. Run the app on the device

Expected result: The Player doesn’t crash
Actual result: The Player crashes

Reproducible with: 2021.3.38f1, 2022.3.28f1, 6000.0.1f1

Testing environment: macOS Sonoma 14.4.1 (Intel), Windows 11 (by user)
Not reproducible on: No other environment tested

Reproducible with these devices:
VLNQA00334 - Xiaomi Mi A3 (Mi A3), CPU: Snapdragon 665 SM6125, GPU: Adreno 610, OS: 11
VLNQA00472 - samsung Galaxy A52 (SM-A525F), CPU: Snapdragon 720G (SM7125), GPU: Adreno 618, OS: 12
VLNQA00460 - Google Pixel 6 (Pixel 6), CPU: Google Tensor (Whitechapel), GPU: Mali-G78, OS: 14
VLNQA00526 - samsung Galaxy A12 (SM-A125F), CPU: Mediatek MT6765 Helio P35 (12nm), GPU: PowerVR Rogue GE8320, OS: 12

Note: Reproducible with {{UnityPlayerForActivityOrService}} too

Crash message:

{noformat}FATAL EXCEPTION: main
Process: com.DefaultCompany.IN74501_LifecycleMethodsCrash, PID: 17702
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.app.Activity.isInMultiWindowMode()' on a null object reference
at com.unity3d.player.MultiWindowSupport.isInMultiWindowMode(Unknown Source:4)
at com.unity3d.player.UnityPlayer.onStart(Unknown Source:2)
at com.unity3d.player.UnityPlayerActivity.onStart(UnityPlayerActivity.java:84)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1436)
at android.app.Activity.performStart(Activity.java:8024)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3456)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2067)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7698)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)
{noformat}

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.