Is it a bug fix? I use 3.17.2 and my wav sound doesn’t play in apk release mode if app is downloaded from store, but play if I launch the debug apk directly on the device.
So I’m trying to found where is the bug.
On IOS no problem, all is fine…
How large are those 80 sound files? When they’re converted in memory, how much memory do they take up? Have you tried uploading the release APK manually to the device, and checked logcat to see if there are any warnings or errors emitted by the app?
Create a custom release version with logging enabled, upload it to your device, and check the output to see what might be happening. It’s a lot quicker than trying to guess what the problem may be.
File size matters. Check it. I believe there’s 256 KB (or something close to this number) limit. After reaching it, different audio engine is used (web audio engine). It’s only on Android. An easy fix is to increase that limit and recompile cocos2d-x.
I rooted my samsung, it is more easy than to publish always. I build a release APK will all inside (±250 mb), and I install the apk directly all is working.
If I split my APK with the software + sounds (±50mb) and the atlas in a OBB/ZIP file, sounds don’t play, the game start, all look good but no sound.
Hi R101,
the problem is clear now for me, if you have an OBB file, for unknow reason the sounds in the APK are not played.
I made this test, all in my APK (sound+atlas sheet sprite), the sounds are played.
If I launch exactly the same APK and I previously added a OBB file in the folder Android/data/obb/com.mycompany.myApp/main.5.com.mycompany.myApp.obb
so the sounds are corrupted
Inside this obb there is only one ATLAS folder (the same than in the APK) not the sounds, the game start but no sounds are played, it fails always in getFileInfo
assetFd = _fdGetterCallback(relativePath, &start, &length); return 0
It seems that accessing obb file corrupt mechanism to play sounds.
I made a small project and had the same problem it is probably a bug or I’m missing something.
I solved like (I know this is not a solution but work for me, I know it is not good to modify cocosfiles)
Since I have only my Atlas in OBB file, when I launch the game I do:
// before to read Atlas in OBB
cocos2d::FileUtilsAndroid::SetObb();
ReadAtlasSheet();
cocos2d::FileUtilsAndroid::DeleteObb();