Hi all,
I am trying to port a cocos2d-x iphone game to android. I can generate the apk file for android. But the sounds in the game seems load very slow in the android emulator. What’s worse, the android game crash with the log (E/AudioCache( 33): Heap size overflow! req size: 1052672, max size: 1048576). And the the VM shut down.
Thank you Minggo. I have replace the mp3 file with smaller audio file, and there is no (E/AudioCache( 33): Heap size overflow! req size: 1052672, max size: 1048576). But the app still crash.
And when the app crash, there is an dialog popup and says, “get data from file faild.” Then the app crash, but there is no log related to this crash.
Hi, Yang, Can you paste a screenshot of the popup msgbox? I guess what you meet is CCFileUtils::getDataFormFile failure. It’s normally caused by the invalid path of resource. Please check if the new audio file is packed into apk ball.
Thank you Minggo and Walzer!
I found the issue. It’s something related to getting values from plist file. And I describ the details in this thread(http://www.cocos2d-x.org/boards/10/topics/2489).
could you help?
Me too porting the iOS cocos2d game: I have one sound constantly played as background and want to play another not small mp3 (1 mb, 60 s) at the same time. First it says “sample not ready” and then “Heap Size overflow”. I’ve found that it is not recommended to play big files as effects on android.
Is there may be any solution now? Did someone tried for example extend SimpleAudiEngine to allow play another sample using MediaPlayer?
Hello again. As a possible solution I tried to extend Cocos2dxMusic.java with the second set of methods -like preloadBackgroundMusic() etc.
I also extended the JNI interface of a SimpleSoundEngine. But on first invokation I get “not static method with name=”preloadBackgroundMusic2" in class org/cocos2dx/lib/Cocos2dxHelper".