Android ANR question

Hi, everyone!
How to identify the cause of high ANR in an android game on Google play? The game, when tested within the team, does not show unstable operation even on devices that have requirements below the minimum set by us in Google play. At the same time, Google play in the console shows a high ANR precent (~1.7%).

The game: https://play.google.com/store/apps/details?id=com.panacotagames.project_hole&hl=en

I also have ANR logs from the Google console. But I don’t understand at all how they are worth reading and what conclusions to draw from them. I’ll leave the 2 most popular errors here. They are similar

#00  pc 0x0000000000088fdc  /apex/com.android.runtime/lib64/bionic/libc.so (syscall+28)
#01  pc 0x000000000008d8c0  /apex/com.android.runtime/lib64/bionic/libc.so (__futex_wait_ex+144)
#02  pc 0x00000000000faa08  /apex/com.android.runtime/lib64/bionic/libc.so (pthread_cond_wait+72)
#03  pc 0x000000000001b098  /data/app/~~tXRAtEZLeEXqAvUGsApoHQ==/com.panacotagames.project_hole-Qq9-ji7EiTTL87IrhHxXAA==/lib/arm64/libgame.so (onPause+144) (BuildId: 63a9c67744e6c7b4a6430879d2668989f70d8c5e)
  at com.google.androidgamesdk.GameActivity.onPauseNative (GameActivity.java)
  at com.google.androidgamesdk.GameActivity.onPause (GameActivity.java:388)
  at com.unity3d.player.UnityPlayerGameActivity.onPause (UnityPlayerGameActivity.java:107)
  at android.app.Activity.performPause (Activity.java:8778)
  at android.app.Instrumentation.callActivityOnPause (Instrumentation.java:1585)
  at android.app.ActivityThread.performPauseActivityIfNeeded (ActivityThread.java:5707)
  at android.app.ActivityThread.performPauseActivity (ActivityThread.java:5668)
  at android.app.ActivityThread.handlePauseActivity (ActivityThread.java:5620)
  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:2574)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loopOnce (Looper.java:226)
  at android.os.Looper.loop (Looper.java:313)
  at android.app.ActivityThread.main (ActivityThread.java:8762)
  at java.lang.reflect.Method.invoke (Native method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:604)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067)

And another

  #00  pc 0x0000000000099000  /apex/com.android.runtime/lib64/bionic/libc.so (syscall+32)
#01  pc 0x000000000009dc98  /apex/com.android.runtime/lib64/bionic/libc.so (__futex_wait_ex+148)
#02  pc 0x0000000000104264  /apex/com.android.runtime/lib64/bionic/libc.so (pthread_cond_wait+80)
  #03  pc 0x000000000001c5d8  /data/app/~~T9y6y8713sD9a68zNCmR7w==/com.panacotagames.project_hole-YuCymtZJTLLvpy4Uitml5w==/lib/arm64/libgame.so (BuildId: c026babccfd14c5c84b3adfcc1c39c4e3759273e)
  #04  pc 0x0000000000351230  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+144)
  #05  pc 0x00000000005b9610  /apex/com.android.art/lib64/libart.so (nterp_helper+5648)
  #06  pc 0x00000000006877de  /data/app/~~T9y6y8713sD9a68zNCmR7w==/com.panacotagames.project_hole-YuCymtZJTLLvpy4Uitml5w==/base.apk (com.google.androidgamesdk.GameActivity.onPause+10)
  #07  pc 0x00000000005b8f54  /apex/com.android.art/lib64/libart.so (nterp_helper+3924)
  at com.google.androidgamesdk.GameActivity.onPauseNative (GameActivity.java)
  at com.google.androidgamesdk.GameActivity.onPause (GameActivity.java:388)
  at com.unity3d.player.UnityPlayerGameActivity.onPause (UnityPlayerGameActivity.java:120)
  at android.app.Activity.performPause (Activity.java:8973)
  at android.app.Instrumentation.callActivityOnPause (Instrumentation.java:1676)
  at android.app.ActivityThread.performPauseActivityIfNeeded (ActivityThread.java:5619)
  at android.app.ActivityThread.performPauseActivity (ActivityThread.java:5580)
  at android.app.ActivityThread.handlePauseActivity (ActivityThread.java:5532)
  at android.app.servertransaction.PauseActivityItem.execute (PauseActivityItem.java:55)
  at android.app.servertransaction.ActivityTransactionItem.execute (ActivityTransactionItem.java:45)
  at android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:185)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:103)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2643)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loopOnce (Looper.java:257)
  at android.os.Looper.loop (Looper.java:368)
  at android.app.ActivityThread.main (ActivityThread.java:8848)
  at java.lang.reflect.Method.invoke (Native method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:572)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1049)

Sorry for bad English. I used translator

Which Unity version are you using?

We are using a Unity 6000.0.11f1.

ANR is basically when UI thread is stuck by waiting on something, usually another thread. Thus to see why ANR is happening stacktraces from all threads need to be printed.

Another thing, you’re using GameActivity as far as I see, GameActivity layer is provided by Google (GameActivity  |  Android game development  |  Android Developers), as a test you could switch to Activity instead in Player Settings Application Entry Point and see if there’s a difference in ANR perenctage.

Either way a dump from all threads is required.

I’m having the exact same problem. In fact, this issue is our #1 ANR. Also using 6000.0.11f1 (but also seen in 14f1).
I will try you suggestion of using Activity instead of GameActivity.

Here are some stacktraces from other threads, maybe it helps:

  at java.lang.Object.wait (Native method)
  at java.lang.Object.wait (Object.java:386)
  at java.lang.Object.wait (Object.java:524)
  at java.lang.Daemons$ReferenceQueueDaemon.runInternal (Daemons.java:247)
  at java.lang.Daemons$Daemon.run (Daemons.java:145)
  at java.lang.Thread.run (Thread.java:1012)
  at java.lang.Object.wait (Native method)
  at java.lang.Object.wait (Object.java:386)
  at java.lang.ref.ReferenceQueue.remove (ReferenceQueue.java:210)
  at java.lang.ref.ReferenceQueue.remove (ReferenceQueue.java:231)
  at WV.Yc.run (chromium-TrichromeWebViewGoogle.aab-stable-653310331:3)
at jdk.internal.misc.Unsafe.park (Native method)
  at java.util.concurrent.locks.LockSupport.parkNanos (LockSupport.java:252)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos (AbstractQueuedSynchronizer.java:1672)
  at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1188)
  at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:905)
  at java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1071)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1131)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:644)
  at java.lang.Thread.run (Thread.java:1012)

I confirm that using Activity instead of GameActivity, prevents this crash.