1. view environment (check PATH and corresponding 2dx version) terminal: open. bash_profileexportPATH $ {PATH}: UsersadminDocumentsworkandroidandroid-sdk-macosxtoolsexportCOCOS2DX_ROOTUsersadminDocumentsworkandroidcocos2d-2.1rc0-x-2.1.2exportANDROID_S
1. view the environment (check path and corresponding 2dx version) terminal: open. bash_profile export PATH =$ {PATH }: /Users/admin/Documents/work/android-sdk-macosx/tools export COCOS2DX_ROOT =/Users/admin/Documents/work/android/cocos2d-2.1rc0-x-2.1.2 export ANDROID_S
1. view the environment (check the path and the corresponding 2dx Version)
Terminal:Open. bash_profile
Export PATH =$ {PATH}:/Users/admin/Documents/work/android-sdk-macosx/tools
Export COCOS2DX_ROOT =/Users/admin/Documents/work/android/cocos2d-2.1rc0-x-2.1.2
Export ANDROID_SDK_ROOT =/Users/admin/Documents/work/android-sdk-macosx
Export ANDROID_NDK_ROOT =/Users/admin/Documents/work/android/android-ndk-r8d
Export NDK_ROOT =/Users/admin/Documents/work/android/android-ndk-r8d
Export PATH = $ PATH: $ ANDROID_NDK_ROOT
Export PATH = $ PATH: $ ANDROID_SDK_ROOT
2. Create an android 2dx Project
(1) cd 2Dx directory
(2)/Create-android-project.shCreate a project
(3) enter the package name
(4) Select android
(5) enter the project name
3. the android 2dx project introduces eclipse and converts it to C ++
(1) Add the newly created ProjectProj. androidImportEclipse
ERROR: Project name. java file ERROR
Delete the original org. cocos2dx package and create the org. cocos2dx. lib package.
Copy the. java file under this directory to the new package (org. cocos2dx. lib package ).
/Users/admin/Documents/work/android/cocos2d-2.1beta3-x-2.1.0/cocos2dx/platform/android/java/src/org/cocos2dx/lib
(2) convertC ++ (SelectMakefile project,MacOSX GCC)
ERROR:
DescriptionResourcePathLocationType error message
Program "g ++" not found in PATHPreferences, C ++/Build/Settings/Discovery, [cdt gcc Built-in Compiler Settings] optionsC/C ++ release disbleproblem
Gcc may not be recognized. The g ++ command installs these two terminal commands through xcode.
(3) Right-click the project and selectProperties
4. Configure the eclipse Environment
Right-click a project and selectProperties
(1) C/C ++ Build:Build command:
... (PATH)/build_native.sh (the file of the project)
(2) Environment:Add on the right:
Name: NDK_ROOT
Value:/Users/admin/Documents/work/android/android-ndk-r8d
(3) C/C ++ General:Paths and Symbols: includes: gun c ++: add
/Users/admin/Documents/work/android/android-ndk-r8d/platforms/android-8/arch-arm/usr/include
/Users/admin/Documents/work/android/cocos2d-2.1beta3-x-2.1.0/CocosDenshion/include
/Users/admin/Documents/work/android/cocos2d-2.1beta3-x-2.1.0/extensions //Extensions uses the class here.
(4) C/C ++ General:Paths and Symbols: Output Location:
Project Classes directory
/Users/admin/Documents/work/android/cocos2d-2.1rc0-x-2.1.2/Cocos2dx directory
/Users/admin/Documents/work/android/cocos2d-2.1beta3-x-2.1.0/extensions //Extensions uses the class here.
5. Move the android 2dx project out of the ../cocos2d-2.1rc0-x-2.1.2 folder
(1) Modify build_native.sh
COCOS2DX_ROOT = "/Users/admin/Documents/work/android/cocos2d-2.1beta3-x-2.1.0"
APP_ROOT = "/Users/admin/Desktop/today/AAA"
APP_ANDROID_ROOT = "/Users/admin/Desktop/today/AAA/proj. android"
NDK_ROOT = "/Users/admin/Documents/work/android/android-ndk-r8d" // some do not need to be modified
(2) Change the file path of 4 (1) to/Users/admin/Desktop/today/AAA/proj. android/build_native.sh.
ERROR: If you have compiled 2dx projects/Users/admin/Documents/work/android/cocos2d-2.1beta3-x-2.1.0/WU/proj. android/obj
Delete the obj directory. The obj directory is generated after compiling c ++.
6. do not compile.../build_native.sh on the terminal
Bash $ {workspace_loc:/ATest}/build_native.sh NDK_DEBUG = 1 V = 1
Add NDK_ROOT =/Users/admin/Documents/android/android-ndk-r8d after # options
7. Introduce the 2dx android project from other places
(1) rebuild the environment according to Step 4
(2) modify the build_native.sh file according to Step 5.
(3) modify the file (build_native.sh) Permission
Error: Permission denied
Chmod-R 777FilePath
ERROR: If you have compiled 2dx projects/Users/admin/Documents/work/android/cocos2d-2.1beta3-x-2.1.0/WU/proj. android/obj
Delete the obj directory. The obj directory is generated after compiling c ++.