Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug Game crash but The stack trace looks internal

Discussion in 'Android' started by egutentag, Aug 28, 2023.

  1. egutentag

    egutentag

    Joined:
    Nov 27, 2020
    Posts:
    14
    Hi I am getting this stack trace in quest crash but I don't see the source from my code:
    ```
    Stack Trace
    Waiting-To-Kill:
    java.lang.Error: FATAL EXCEPTION [main]
    Unity version : 2020.3.41f1
    ABI : arm64-v8a
    Strip Engine Code : true
    Caused by: java.lang.IllegalArgumentException: width and height must be > 0
    at android.graphics.Bitmap.createBitmap(Bitmap.java:1095)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:1062)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:1012)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:973)
    at com.unity3d.player.h$a.a(Unknown Source:10)
    at com.unity3d.player.h.a(Unknown Source:15)
    at com.unity3d.player.UnityPlayer$19.surfaceDestroyed(Unknown Source:20)
    at android.view.SurfaceView.notifySurfaceDestroyed(SurfaceView.java:1981)
    at android.view.SurfaceView.updateSurface(SurfaceView.java:1065)
    at android.view.SurfaceView.setFrame(SurfaceView.java:580)
    at android.view.View.layout(View.java:23200)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
    at android.view.View.layout(View.java:23203)
    at android.view.ViewGroup.layout(ViewGroup.java:6412)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
    at android.view.View.layout(View.java:23203)
    at android.view.ViewGroup.layout(ViewGroup.java:6412)
    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)
    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
    at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
    at android.view.View.layout(View.java:23203)
    at android.view.ViewGroup.layout(ViewGroup.java:6412)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
    at com.android.internal.policy.DecorView.onLayout(DecorView.java:797)
    at android.view.View.layout(View.java:23203)
    at android.view.ViewGroup.layout(ViewGroup.java:6412)
    at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:3784)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3234)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2199)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8860)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1037)
    at android.view.Choreographer.doCallbacks(Choreographer.java:845)
    at android.view.Choreographer.doFrame(Choreographer.java:780)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:214)
    at android.os.Looper.loop(Looper.java:304)
    at android.app.ActivityThread.main(ActivityThread.java:7909)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1010)
    ```
     
  2. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,659
    That code is called from within Unity engine, Unity 2020.x is no longer supported, can you check if the same happens with Unity 2021 LTS?
     
  3. ATNATNA

    ATNATNA

    Joined:
    Dec 14, 2018
    Posts:
    2
    Hello, I've got this bug here too.When I call up other apps in my apk, they crash. The following are the contents of the log:
    2023-09-13 10:17:07.658 1854-1854/? E/Bitmap: OOM allocating Bitmap with dimensions 2400 x 16652986
    2023-09-13 10:17:07.659 1854-1854/? D/AndroidRuntime: Shutting down VM
    2023-09-13 10:17:07.661 1854-1854/? E/AndroidRuntime: FATAL EXCEPTION: main
    java.lang.OutOfMemoryError
    at android.graphics.Bitmap.nativeCreate(Native Method)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:1137)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:1095)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:1045)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:1006)
    at com.unity3d.player.h$a.a(Unknown Source:10)
    at com.unity3d.player.h.a(Unknown Source:15)
    at com.unity3d.player.UnityPlayer$28.surfaceDestroyed(Unknown Source:20)
    at android.view.SurfaceView.notifySurfaceDestroyed(SurfaceView.java:1934)
    at android.view.SurfaceView.updateSurface(SurfaceView.java:1111)
    at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:345)
    at android.view.View.dispatchWindowVisibilityChanged(View.java:15455)
    at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1628)
    at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1628)
    at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1628)
    at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1628)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3053)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2544)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9421)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1451)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1459)
    at android.view.Choreographer.doCallbacks(Choreographer.java:1089)
    at android.view.Choreographer.doFrame(Choreographer.java:1003)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1431)
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:210)
    at android.os.Looper.loop(Looper.java:299)
    at android.app.ActivityThread.main(ActivityThread.java:8240)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:559)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
     
  4. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,659
    If I am not mistaken, this should match screen resolution, and 16652986 looks very suspicious in this case.

    What's your screen resolution, on what device this happens?
     
  5. Alan-Liu

    Alan-Liu

    Joined:
    Jan 23, 2014
    Posts:
    345
    Same crash here (Unity 2020.3.48):
    Code (CSharp):
    1. Exception java.lang.Error: FATAL EXCEPTION [main]
    2. Unity version     : 2020.3.48f1
    3. Device model      : OPPO CPH2359
    4. Device fingerprint: OPPO/CPH2359/OP5339L1:13/TP1A.220905.001/S.10f4acf-59f:user/release-keys
    5. Build Type        : Release
    6. Scripting Backend : IL2CPP
    7. ABI               : arm64-v8a
    8. Strip Engine Code : true
    9.  
    10. Caused by: java.lang.OutOfMemoryError
    11.   at android.graphics.Bitmap.nativeCreate
    12.   at android.graphics.Bitmap.createBitmap (Bitmap.java:1132)
    13.   at android.graphics.Bitmap.createBitmap (Bitmap.java:1090)
    14.   at android.graphics.Bitmap.createBitmap (Bitmap.java:1040)
    15.   at android.graphics.Bitmap.createBitmap (Bitmap.java:1001)
    16.   at com.unity3d.player.h$a.a
    17.   at com.unity3d.player.h.a
    18.   at com.unity3d.player.UnityPlayer$19.surfaceDestroyed
    19.   at android.view.SurfaceView.notifySurfaceDestroyed (SurfaceView.java:2037)
    20.   at android.view.SurfaceView.updateSurface (SurfaceView.java:1153)
    21.   at android.view.SurfaceView.onWindowVisibilityChanged (SurfaceView.java:356)
    22.   at android.view.View.dispatchWindowVisibilityChanged (View.java:15521)
    23.   at android.view.ViewGroup.dispatchWindowVisibilityChanged (ViewGroup.java:1645)
    24.   at android.view.ViewGroup.dispatchWindowVisibilityChanged (ViewGroup.java:1645)
    25.   at android.view.ViewGroup.dispatchWindowVisibilityChanged (ViewGroup.java:1645)
    26.   at android.view.ViewGroup.dispatchWindowVisibilityChanged (ViewGroup.java:1645)
    27.   at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:2997)
    28.   at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:2458)
    29.   at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:9478)
    30.   at android.view.Choreographer$CallbackRecord.run (Choreographer.java:1412)
    31.   at android.view.Choreographer$CallbackRecord.run (Choreographer.java:1420)
    32.   at android.view.Choreographer.doCallbacks (Choreographer.java:1047)
    33.   at android.view.ChoreographerExtImpl.checkScrollOptSceneEnable (ChoreographerExtImpl.java:451)
    34.   at android.view.Choreographer.doFrame (Choreographer.java:918)
    35.   at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:1395)
    36.   at android.os.Handler.handleCallback (Handler.java:942)
    37.   at android.os.Handler.dispatchMessage (Handler.java:99)
    38.   at android.os.Looper.loopOnce (Looper.java:240)
    39.   at android.os.Looper.loop (Looper.java:351)
    40.   at android.app.ActivityThread.main (ActivityThread.java:8416)
    41.   at java.lang.reflect.Method.invoke
    42.   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:584)
    43.   at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1013)
    Most of the crashes happend on OPPO devices:
    upload_2023-9-14_10-12-8.png

    Some devices:
    • OPPO OP5339L1 (OPPO Reno8 5G): 1080x2400
    • OPPO OP4F1BL1 (CPH2145): 1080x2400
    • OPPO OP56EDL1 (Reno8 T 5G): 1080x2412
     
  6. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,659
    Try upgrading to latest LTS, for ex. Unity 2021 LTS
     
  7. ATNATNA

    ATNATNA

    Joined:
    Dec 14, 2018
    Posts:
    2

    Device:xiaomi 13 Pro
    Resolution 1440 x 3200 pixels, 20:9 ratio (~522 ppi density)
    My Unity project is version 2020.3.32f1c1 and I cannot change the Unity version. I added reflection to get UnityPlayer.this.mGlView before switching to other apps, and found that the content in logcat was normal. After I added a break point, the value looked like this:
    upload_2023-9-15_11-11-3.jpeg
     
  8. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,659
    Well width matches with the one in the exception, not sure why height mismatches, we would need a bug report.

    Also note, since 2020.x is no longer supported, even in case of a bug, no fixes will be applied to 2020.x