Cocos2d-x Xcode config for iOS / Andriod

    1. Install Xcode, Android SDK/NDK
    2. Craete cocos 2d-x project in Xcode
    4. Run
    5. Copy generated folder into the iOS project root
    6. Copy platform/android/java/src/org/cocos2dx/lib/* into*
    7. Update COCOS2DX_ROOT in
    8. Use Eclipse, or create a new target for Android in the Xcode project … I created a new target as ‘external build system’ which calls

function test_ret_code(){
▸   ret=$?
▸   if [ $ret -ne 0 ]; then
▸   ▸   echo "error: $1 failed, ret:$ret"
▸   ▸   exit 1
▸   fi

export  NDK_ROOT="/Users/sokoide/android-ndk-r8b"
echo "*** custom build started"
test_ret_code ""
/usr/bin/ant -f /Users/sokoide/Projects/iPhone/Spike/c2dxspike/c2dxspike/ debug install
test_ret_code "install"
/Users/sokoide/android-sdks/platform-tools/adb shell am start -n com.sokoide.c2dx/.spike
test_ret_code "adb shell am start"

echo "*** custom build completed"
exit 0

cocos2dx on iOS and Android Test app on iOS (480×320) and Android (800×480). I scaled the background, but didn’t for the label on top.

Automatic crash collection

I found an awesome service at
You can download and set it up within 30 mins with only 3 line additions / lib additions. You’ll get crash reports with callstack. If you send a symbol file (dSYM), you’ll get a name resolved stack.

Add these lines

#import "Crittercism.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // crash report
    [Crittercism initWithAppID: kAppId];

To test, add this line

    [NSException raise:NSInvalidArgumentException
                format:@"Hoge must not be nil"];

To get UUID of the binary,

dwarfdump --uuid /Volumes/RamDisk/Xcode/DerivedData/.../Products/Debug-iphoneos/ 
UUID: 02BAD808-5764-3AD9-B977-7101C7DEC749 (armv7) /Volumes/RamDisk/Xcode/...