Android ANR Issue

Hello, friends.

Today, I’ve brought up a chronic issue we’re facing. We’ve been trying to resolve it on our own, but it seems quite challenging.

First, let me outline our development environment:

Cocos Creator Version: 3.8.1
Target SDK: 33

We’re currently using these for our game.

We’ve been experiencing frequent ANRs (Application Not Responding) while our game is live. This issue seems to have started after upgrading to this engine version from the previous 3.7.x, which didn’t have this problem.

The ANR logs are as follows, but I’m not sure where to start in terms of troubleshooting.

Is there anyone who can help us out with this?

#00 pc 0x0000000000089af4 /apex/com.android.runtime/lib64/bionic/libc.so (syscall+36)
#01 pc 0x000000000008e4d8 /apex/com.android.runtime/lib64/bionic/libc.so (__futex_wait_ex+148)
#02 pc 0x00000000000f4964 /apex/com.android.runtime/lib64/bionic/libc.so (pthread_cond_timedwait+140)
#03 pc 0x00000000002ae670 /data/app/~~hjYYL-mYHtFeiwyui7-eTA==/com.chamelio.magicraft-KQsKaOo5pPC5yt0v7HB1Hg==/split_config.arm64_v8a.apk (android_app_set_activity_state+307200) (BuildId: b265e677a1024ac1fb31fefcb35a23d932ce41da)
at com.google.androidgamesdk.GameActivity.onPauseNative (GameActivity.java)
at com.google.androidgamesdk.GameActivity.onPause (GameActivity.java:299)

We will take a look the modification of related codes.

Is your Target SDK also 33 in your 3.7.x version?

Yes it was. But this error was happened after I upgrade engine to 3.8.1

Could you upload anr file from /data/anr/xx.txt ?
With this file information, we can obtain the execution stack of the game thread.

here is the stack trace file

Unfortunately, it is not currently reproduced.

stacktrace.log.zip (7.7 KB)

Has this file been trimmed? Normally there should be v8 thread information, but I didn’t see any game thread related information in the uploaded file.

The logs I shared are from the Google Play Developer Console. Currently, it’s challenging to reproduce the issue, so it’s difficult to identify the exact error point on our own. If there’s another way to obtain the logs, please let me know. I’ll then attach the file again. @freely0417

Are there any large audio files used in your project?

We got the same ANR on 3.8.x, it’s very small impact on our game but we have it too.
We don’t use large audio file and as gandangf we cannot reproduce it, we just see this on google play.

@Azaratur Are there reward-based ads in your game too? Based on my current guess, it seems that issues mainly occur when the reward-based ad logic is executed.

I too have the same issue. An error seems to occur in rewarded advertising. This is very fatal.