1. Check that your eclipse environment has been configured on mac. [android code can be compiled on eclipse and can be run on a virtual machine or on a real machine.] the address of my sdk is:
[Plain]
Localhost: android-sdk-macosx b126 $ pwd
/Android/android-sdk-macosx
Localhost: android-sdk-macosx b126 $
2. Download The ndk from the Internet and decompress it to a directory. The decompressed directory is as follows:
[Plain]
Localhost: android-ndk-r8 b126 $ pwd
/Android/android-ndk-r8
3. Download cocos2dx and decompress it to a directory. The decompressed directory is:
[Plain]
Localhost: cocos2d-1.0.1-x-0.13.0-beta b126 $ pwd
/Android/cocos2d-1.0.1-x-0.13.0-beta
4. input data to the terminal in the cocos2dx directory:
[Plain]
Localhost: cocos2d-1.0.1-x-0.13.0-beta b126 $ vim create-android-project.sh
Display:
[Plain]
#! /Bin/bash
# This script shocould be called by create-android-project.bat
# Or shoshould 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
There are two places to modify. One is the sdk and the other is the ndk address:
[Plain]
NDK_ROOT_LOCAL = "/home/laschweinski/android/android-ndk-r5"
ANDROID_SDK_ROOT_LOCAL = "/home/laschweinski/android/android-sdk-linux_86"
I believe this step is okay.
5. Save and run the command
[Plain]
Localhost: cocos2d-1.0.1-x-0.13.0-beta b126 $./create-android-project.sh
The subsequent steps and I in: cocos2dx in windows development, compiled to android (2) http://www.bkjia.com/kf/201205/130697.html 6th step after the introduction is the same, please refer to see Ha, I will not introduce it here.
From the ComeOnTom Column