Cocos2d-x Xcode config for iOS / Andriod

    1. Install Xcode, Android SDK/NDK
    2. Craete cocos 2d-x project in Xcode
    3. Update NDK_ROOT_LOCAL and ANDROID_SDK_ROOT in create-android-project.sh
    4. Run create-android-project.sh
    5. Copy generated proj.android folder into the iOS project root
    6. Copy platform/android/java/src/org/cocos2dx/lib/* into proj.android/src/org/cocos2dx/lib/*
    7. Update COCOS2DX_ROOT in build_native.sh
    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 build_android_ver.sh.
#!/bin/sh

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"
/Users/sokoide/Projects/iPhone/Spike/c2dxspike/c2dxspike/proj.android/build_native.sh
test_ret_code "build_native.sh"
/usr/bin/ant -f /Users/sokoide/Projects/iPhone/Spike/c2dxspike/c2dxspike/proj.android/build.xml 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.