As I mentioned in the title, when I load a music song named music1.mp3
that stored in assets/music/music1.mp3
. The logcat show Fatal error 11 (SIGSEGV) at 0x000000 (code 11)
and app gets force close. As far as I know, the Fatal error 11
caused by accessing a NULL element or sth that have been already released. I've logged FileUtils::getInstance->getSearchPath()
and the result is assets/music
as expected. But when I tried to log the path of music1.mp3
in getFullPathForFilename
, it only showed up assets/music1.mp3
that make my app crash. Can anyone explain why it cannot access in assets subfolder (music) to find music1.mp3
file? Sr for my bad english :D
P/s: my app runs perfecty in iOS.
Any helps would be appreciated.
Thank for reading.
You need to add search path to your FileUtil, as:
FileUtils::getInstance()->addSearchPath("SEARCH_PATH");
The other solution that I typically use is simply putting the full path in your loading routine. This will give you a very better understanding of what is going on and it also helps with consistency between Android and iOS:
CocosDenshion::SimpleAudioEngine::getInstance()->playBackgroundMusic(
"music/msc1.mp3", true);