An audio engine error that occurs only in the Android Release version

Hi guys?

I found a bug that I found while building the beta version of the game this time, so please share. This is an error that only occurs in Signed APK, not in debug mode.

The reproduction method is simple, but by loading two or more of any AudioClip, it plays indefinitely through the scheduler. Then soon the app crashes.

like this


playEffect() {
const audioList = this.assetManager.audioList(-> this is preloaded audio clip array);
for (let i in audioList) {

This is an error that doesn’t occur in debug mode, so it took me a long time to find it. I solved it with defense logic, but I think this is a very big problem.

I’m using cocos creator version 3.5.2 now. (172.6 KB)
My test result is normal, no crash.

First of all, I confirmed that there is no problem with the project you uploaded, but when we add some sound effects that are being used in our game to the project, an error occurs again.

Considering this phenomenon, it seems that an error occurs when a specific sound effect is added, but I don’t know what exactly is the problem.

The build settings have been changed to the current build settings of our project, and the compilation SDK version is 30.

NewProject_10 (2.9 MB)

I tested a little more, but this phenomenon occurs even when the compilation SDK is set to 27, and if I play these two files(“bead_dragon+”, “bead_event+” ) consecutively among the attached sound effects, I get an error. Hmm… I don’t know what’s special about these two files. (749.5 KB)
try this? I compressed the audio file → “bead_event+”

Ah, compression solves the problem. What compression did you use? And would compressing all sound effects solve this problem? I plan to add sound effects in the future, but I’m worried that something like this might happen.

For reference, I dealt with this error by playing again until the same sound effect ends with the current logic.

Each platform has a limit on the number of sound effects that can be played at the same time, and audio glitches may occur when a certain numerical limit is exceeded.
Because the “bead_event” file is too large, it cannot be preloaded when playing multiple sound effects at the same time, to play it will load the “dead_event”, which will occupy a playback track and cause playback timeouts to block due to frequent playback.
So if you want to play many sound effects at the same time, you need to pay attention to the file can not be too large, play can not be too frequent, the file should not be too much.

I use a third-party audio compression software to do the compression.

Oh, now I know what the problem is. I’m learning another one. Thank you very much for your kind reply!