High ANR on the game and would like to ask some suggestions

4 views
Skip to first unread message

seal2002

unread,
Jun 24, 2026, 7:39:59 PM (8 hours ago) Jun 24
to android-ndk
Hi everyone,

I'am seeing ANR rates on the main thread that consistently exceed my game threshold in production (via Play Console / crash reporting), but I cannot reproduce the issue locally or in test environment at all.

Some context:
- The ANRs are reported on the main thread
- I'm using Android NDK 27.3 with Native target API is 29
- The ANR rate is high enough to trigger alerts, but the stack traces don't point to an obvious bottleneck
- I have not been able to reproduce it on any device or emulator in-house. ( The tester team cannot reproduce it as well)

So my questions:
1. Can I trust that the ANR signals from Play Console are genuinely triggering on the main thread, or could there be false positives / misattribution from the NDK layer?
2. What are the best strategies to debug ANRs that only appear in production and cannot be reproduced locally — especially when native code is involved? Please note that I used the Firebase Crashlytic before and transitioned to Backtrace last year, but nothing help. And I'm switching back to Firebase because it has some cool feature now.
3. Are there any NDK-specific pitfalls (e.g., JNI calls blocking the main thread, mutex contention from native threads) that could silently cause ANRs without being obvious in traces?

Any insights or pointers to relevant tools/techniques would be greatly appreciated. Thank you.

"main" tid=1 Native
  #00  pc 0x000000000004f55c  /apex/com.android.runtime/lib64/bionic/libc.so (syscall+28)
  #01  pc 0x0000000000053e40  /apex/com.android.runtime/lib64/bionic/libc.so (__futex_wait_ex+144)
  #02  pc 0x00000000000c0838  /apex/com.android.runtime/lib64/bionic/libc.so (pthread_cond_wait+72)
  #03  pc 0x000000000fa44538  /data/app/~~q3-XfR3iyyF17omqs8QHow==/com.haiphan.MyMiniGame-BEC99_6SixMGMBQDZtU7fw==/lib/arm64/libMyMiniGame.so (std::__ndk1::condition_variable::wait(std::__ndk1::unique_lock<std::__ndk1::mutex>&)+24) (BuildId: 646cd20ab818e061769e8fbb84690797)
  #04  pc 0x000000000e63b2fc  /data/app/~~q3-XfR3iyyF17omqs8QHow==/com.haiphan.MyMiniGame-BEC99_6SixMGMBQDZtU7fw==/lib/arm64/libMyMiniGame.so (_MainThreadOnNativeWindowDestroyed+146) (BuildId: 646cd20ab818e061769e8fbb84690797)
  #05  pc 0x000000000e640678  /data/app/~~q3-XfR3iyyF17omqs8QHow==/com.haiphan.MyMiniGame-BEC99_6SixMGMBQDZtU7fw==/lib/arm64/libMyMiniGame.so (onSurfaceDestroyed_native+827) (BuildId: 646cd20ab818e061769e8fbb84690797)
  at com.google.androidgamesdk.GameActivity.onSurfaceDestroyedNative (GameActivity.java)
  at com.google.androidgamesdk.GameActivity.surfaceDestroyed (GameActivity.java:591)
  at com.haiphan.jpal.JPal.surfaceDestroyed (JPal.java:317)
  at com.haiphan.MyMiniGame.CommonActivity.surfaceDestroyed (CommonActivity.java:521)
  at android.view.SurfaceView.notifySurfaceDestroyed (SurfaceView.java:1954)
  at android.view.SurfaceView.updateSurface (SurfaceView.java:1089)
  at android.view.SurfaceView.onWindowVisibilityChanged (SurfaceView.java:364)
  at android.view.View.dispatchWindowVisibilityChanged (View.java:15457)
  at android.view.ViewGroup.dispatchWindowVisibilityChanged (ViewGroup.java:1627)
  at android.view.ViewGroup.dispatchWindowVisibilityChanged (ViewGroup.java:1627)
  at android.view.ViewGroup.dispatchWindowVisibilityChanged (ViewGroup.java:1627)
  at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:3017)
  at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:2506)
  at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:9478)
  at android.view.Choreographer$CallbackRecord.run (Choreographer.java:1323)
  at android.view.Choreographer$CallbackRecord.run (Choreographer.java:1331)
  at android.view.Choreographer.doCallbacks (Choreographer.java:964)
  at android.view.Choreographer.doFrame (Choreographer.java:878)
  at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:1306)
  at android.os.Handler.handleCallback (Handler.java:942)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:204)
  at android.os.Looper.loop (Looper.java:291)
  at android.app.ActivityThread.main (ActivityThread.java:8134)
  at java.lang.reflect.Method.invoke (Native method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:588)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1019)
Reply all
Reply to author
Forward
0 new messages