cocos2dx编译HelloWorld

到cocos2d下载  cocos2d-1.0.1-x-0.9.2

进入cocos2d-1.0.1-x-0.9.2/HelloWorld/android目录

改写build_native.sh 文件

# set params
ANDROID_NDK_ROOT=/Users/rye/android/android-ndk-r6b
COCOS2DX_ROOT=/Users/rye/MyHome/cocos2d-1.0.1-x-0.9.2/
HELLOWORLD_ROOT=$COCOS2DX_ROOT/HelloWorld/android

# make sure assets is exist
if [ -d $HELLOWORLD_ROOT/assets ]; then
    rm -rf $HELLOWORLD_ROOT/assets
fi

mkdir $HELLOWORLD_ROOT/assets

# copy resources
for file in $COCOS2DX_ROOT/HelloWorld/Resource/*
do
    if [ -d $file ]; then
        cp -rf $file $HELLOWORLD_ROOT/assets
    fi

    if [ -f $file ]; then
        cp $file $HELLOWORLD_ROOT/assets
    fi
done

# build
pushd $ANDROID_NDK_ROOT
./ndk-build -C $HELLOWORLD_ROOT $*
popd

运行文件  即可编译成功

你可能感兴趣的:(android,cocos2d)