cocos2dx在xcode下开发,编译到android上(2)
1、请先确认你eclipse环境已经mac上配置好了【在eclipse上能够编译android代码,并可以运行在虚拟机上或者真机上】我sdk所在的地址是:
[plain]
localhost:android-sdk-macosx b126$ pwd
/Android/android-sdk-macosx
localhost:android-sdk-macosx b126$
2、在网上下载ndk,解压在一个目录下,我解压后的目录如下:
[plain]
localhost:android-ndk-r8 b126$ pwd
/Android/android-ndk-r8
3、下载cocos2dx,并解压到一个目录,我解压后的目录是:
[plain]
localhost:cocos2d-1.0.1-x-0.13.0-beta b126$ pwd
/Android/cocos2d-1.0.1-x-0.13.0-beta
4、在cocos2dx目录下的终端输输入:
[plain]
localhost:cocos2d-1.0.1-x-0.13.0-beta b126$ vim create-android-project.sh
显示:
[plain]
#!/bin/bash
# This script should be called by create-android-project.bat
# or should be runned in linux shell. It can not be runned under
# cygwin.
# Don't modify the script until you know what you do.
# set environment paramters
NDK_ROOT_LOCAL="/home/laschweinski/android/android-ndk-r5"
ANDROID_SDK_ROOT_LOCAL="/home/laschweinski/android/android-sdk-linux_86"
NEED_BOX2D=false
NEED_CHIPMUNK=false
NEED_LUA=false
# try to get global variable
if [ $NDK_ROOT"aaa" != "aaa" ]; then
echo "use global definition of NDK_ROOT: $NDK_ROOT"
NDK_ROOT_LOCAL=$NDK_ROOT
fi
if [ $ANDROID_SDK_ROOT"aaa" != "aaa" ]; then
echo "use global definition of ANDROID_SDK_ROOT: $ANDROID_SDK_ROOT"
ANDROID_SDK_ROOT_LOCAL=$ANDROID_SDK_ROOT
需要修改的地方有两个,一个是sdk和ndk的地址:
[plain]
NDK_ROOT_LOCAL="/home/laschweinski/android/android-ndk-r5"
ANDROID_SDK_ROOT_LOCAL="/home/laschweinski/android/android-sdk-linux_86"
相信这步大家没问题了。
5、保存,并用命令运行
[plain]
localhost:cocos2d-1.0.1-x-0.13.0-beta b126$ ./create-android-project.sh
后面的步骤和我在:cocos2dx在windows下开发,编译到android上(2)http://www.zzzyk.com/kf/201205/130697.html 第6步以后的介绍是一样的,请大家参照着看哈,在此我就不做介绍了
摘自 ComeOnTom的专栏
补充:移动开发 , 其他 ,