Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)

I’m developing an application for Android using cocos2d-x. I’m new to cocos2d-x and C*+ and I’m on windows, I have followed due process from creating the Cocos2d-x project template for Eclipse to importing the project into Eclipse and adding c*+ features to it etc… I succesfully got my app to run in the emulator(target API 4.1) and it gives me the cocos2d “HelloWorld Splash” as expected. Problem is, now I’m trying to change my Application background image. I added an image in the assets directory and changed the code in “HelloWorldScene.cpp” that creates the default HelloWorld Sprite

from:

CCSprite* pSprite = CCSprite::create(“HelloWorld.png”);

to:

CCSprite* pSprite = CCSprite::create(“background.jpg”);

Once I do the latter, my emulator crashes after trying to run the App and in logcat I get the error “Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)”, but if I put back the default HelloWorld.png it runs again smoothly in the emulator.

I use cocos2d-2.0-rc2-x-2.0.1 and android-ndk-r8b. This App runs only on a 4.1 API device emulator, I can’t get it to run on 2.3.3 and 4.3 as it crashes while trying to run. Please, kindly help me out please

Be sure to check the spelling of your file(case-sensitive), if your file is “Background.jpg” and you place “background.jpg” in your code, CCPSprite will fail to load the file and throw an error.

Thanks for the response, but it’s not the spelling. It’s probably something else I’m yet to find out about

Try refreshing Eclipse to make sure that your .jpg file is absolutely, positively included in the apk bundle (right click project->refresh). Also try a .png… perhaps your Android implementation trips up on that particular type of jpg?

Ben

Got this reply from a friend, it worked flawlessly:

what cocos2d-x did is, it compiles your c*+ code to a java library first, and put it into the libs/arm-v7s folder, then it use the eclipse build to build this library with assets together to the apk file. once you edit the c*+ file, you have to rebuild the libgame.so. There should be a script sits in android project folder named build_native.sh, you can run it using cygwin(windows) or just run it under Mac. this script will rebuild the source code to library and update assets folder according to whatever you put in the Resources folder

Ah yes, you’ll be running that script a lot as you build stuff for Android. :slight_smile:

Ben