The following is mainly about setting up the COCOS2D-X environment and the Android environment.
1. Download Cocos2d-x 3.0 official version
Http://www.cocos2d-x.org/download
2. Download the Android SDK and the NDK
Http://developer.android.com/sdk/index.html
3. Download Ant
http://ant.apache.org
(Note: COCOS2D-X's environment variable configuration requires ant, mainly Android needs to use it)
4, download the Python 2.7.6 (do not download python3.0 above version, the normal Mac has its own, do not need to download)
https://www.python.org/download/releases/2.7.6/
All the necessary tools have been downloaded, and now it's time to build the environment.
5. Configure the. Bash_profile (this file is not available for self-creation under/users/xuzhiwei/.bash_profile)
Export ndk_root=/users/xuzhiwei/develop/program/android/android-ndk-r9dexport android_sdk_root=/Users/ xuzhiwei/develop/program/android/adt-bundle-mac-x86_64/sdkexport ant_root=/users/xuzhiwei/develop/ program/apache-ant-1.9. 3 export PATH= $ANT _root/bin: $PATH
The above is configured with the Android SDK, NDK and ant environment variables, so it's okay.
6. Use Python script to configure environment variables, Cocos engine root directory
Python setup.py
Follow the prompts, this step is for the new configuration to take effect
source/users/User name/.bash_profile
7, create the project, I believe that the use of 3.0 of the heroes are aware of a Cocos command.
Cocos new-p Package Name-L language-D directory
Find out more about the commands you can use Cocos-h
-P Package Namespace
-l app Lua JS development language
To the environment under this Mac, even if it's okay.
8, the next thing to say is the relevant part of Android.
First, go to proj.android under command execution
Python build_native.py
And then he started compiling,
After the compilation is complete, open with Eclipse, and import can see the Red "*". Such as
Here is because the package is missing, right-click the property to see
Under TEST3.0/COCOS2D/COCOS/2D/PLATFORM/ANDROID/JAVA/SRC, copy the class package to SRC under the current project, or refer to it as a class library project.
So there's no problem.
But the problem is, it's too much trouble to copy it every time you create it.
Next modify the template in the build_native.py file, and then let the command to help us to the class package in the test.
Note here that the version of the tutorial is 3.0 the latest after 3.5 whether there is still this problem, but also need to determine the actual operation
Cocos Basic Tutorials (1) setting up in a Mac environment