ANR - [libgame.so] android_native_app_glue.c - onPause

I have lots of ANRs with [libgame.so] android_native_app_glue.c - onPause (Input dispatching timed out) and I have no idea why. This started I think after switching to Unity 6.

Does anyone have this ANR and solved it? Or at least figure it out why is happening? Thanks!

Stack trace:

#00 pc 0x0000000000088270 /apex/com.android.runtime/lib64/bionic/libc.so (syscall+32)
#01 pc 0x000000000008cb3c /apex/com.android.runtime/lib64/bionic/libc.so (__futex_wait_ex+148)
This native synchronisation routine is blocking the main thread, causing an ANR Learn more

#02 pc 0x00000000000f0020 /apex/com.android.runtime/lib64/bionic/libc.so (pthread_cond_wait+84)
#03 pc 0x000000000001c620 /data/app/~~5tVbVg6jvXiu_Rl2704Paw==/b3LtXs03SXKqwL9F4wb7Hw==/lib/arm64/libgame.so (onPause+347) (BuildId: b33ecb094ee89aff1a6dd69d659a7cc3e5a1cacd)
at com.google.androidgamesdk.GameActivity.onPauseNative (Native method)
at com.google.androidgamesdk.GameActivity.onPause (GameActivity.java:388)
at com.unity3d.player.UnityPlayerGameActivity.onPause (UnityPlayerGameActivity.java:108)
at android.app.Activity.performPause (Activity.java:8374)
at android.app.Instrumentation.callActivityOnPause (Instrumentation.java:1531)
at android.app.ActivityThread.performPauseActivityIfNeeded (ActivityThread.java:5191)
at android.app.ActivityThread.performPauseActivity (ActivityThread.java:5152)
at android.app.ActivityThread.handlePauseActivity (ActivityThread.java:5104)
at android.app.servertransaction.PauseActivityItem.execute (PauseActivityItem.java:47)
at android.app.servertransaction.ActivityTransactionItem.execute (ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2291)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loopOnce (Looper.java:210)
at android.os.Looper.loop (Looper.java:299)
at android.app.ActivityThread.main (ActivityThread.java:8319)
at java.lang.reflect.Method.invoke (Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:556)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1038)

For ANR, all threads must be shown to get an idea what’s happening.

Since this is related to GameActivity, one quick way to workaround this is to switch to Activity which in case of ANR, ignores synchronization between UI and game loop thread and attempts to proceed further.

Player Settings->Application Entry Point select Activity instead of GameActivity.

Thank you for the answer! I will test this and see how it goes!

Changing to Activity instead of GameActivity throw an error while building (I am using Unity 6000.1.5), the error message : " BaseUnityGameActivityTheme’ not found in AndroidManifest.xml:85,

(See the Console for details)"

I’m pretty sure you have custom AndroidManifest enabled. Make sure you keep correct Activity in the manifest.

Right now I set to Activity instead of GameActivity.

AndroidManifest:

Do I need to remove the GameActivity part?

Read the comment carefully :slight_smile:
image