First, Environment construction
1.JDK, Eclipse and SDK
The JDK I used was 1.7.
Eclipse is using the Luna version.
These have been set up before, related download online find it
2. Download the latest cocos2d-x, I'm under 3.5
Official download page
3.CDT
http://www.eclipse.org/cdt/downloads.php
My practice is that the P2 software repository on the Web page is installed in Eclipse help->install new software online CDT
4.NDK
Http://developer.android.com/tools/sdk/ndk/index.html
Download and unzip the line (TMD does not fq on the Android development site)
5.ANT
http://ant.apache.org/
Download it
6. Install Python
That's what I'm using. 2.7. Version 6
https://www.python.org/download/releases/2.7.6/
7.vs2012
Download degree Niang to find, I next is the 1.5G flagship version, to serial number
What I'm going to do is Android, but look at the other people on the Internet, I'm faking it.
8. Environment variables to configure the Python installation directory path.
9. Command line CMD into DOS
And then into your cocs2d-x3.5 's installation directory.
Enter Python setup.py to start installing the
During the installation, you will be prompted to enter the contents of the unpacked or downloaded content such as SKD NDK ant, etc.
This step if the setting of the track is not a problem, the installation is OK, otherwise it will error. Environment variables will have COCs, later cocos as a DOS command can be used directly.
10. The environment is set up so that a new project can be built, and the default is Hello World
Create a folder that specifically puts the project files, such as E:\mycos
Go to cmd, enter the command in the following format, in parentheses is the description of the previous item
Cocos New Hello (project name)-P Com.hello (package name)-L CPP (project type)-D E:\mycos (directory)
After success, a Hello folder will appear in the Mycos directory, which is the folder of the project you just built.
The proj.android in the Hello folder is the corresponding Android program, which is the folder to be used for Eclipse import later
Second, Android Eclipse Import Project
1. In command line cmd, enter the above mentioned proj.android
Enter Python build_native.py
Long wait until OK
2. Import Project , import->android-existing Android Code into workspace->
Select the Proj.android folder in root directory to import, or a long wait
3. Import the Library project , the first to import this project file location in: Your COCOS2DX installation directory \cocos\platform\android\java
Take this Java folder and copy it to your new project sibling directory, which is copied to E:\mycos.
Import the Java folder in eclipse using the same method as the import item above, and this will soon be a LIBCOCOS2DX project in the Eclipse project list.
4. Right build properties on the Hello Project
Choose android
There's a library at the bottom.
Point to the right of the add, there will be just imported Libcocos2dx,ok
Original Library list If there is an item but a red Cross, delete
5. Open AVD build Android simulator
Taking API19 as an example
Other settings OK, to note that the new window size is variable, down below will find something hidden
The emulation options, in the following option use the check box in front of the Host GPU tick
Do not set this can not run Cocos2d-x project, must pay attention to
6.OK after a long setup, a Hello world is finally going to run on Android
Run the newly built Android simulator in the AVD first
Right-click Run as->android application on the Hello Project
Wait
Ok
Effect, run successfully
Win7+eclipse Build Cocos2d-x 3.5 development environment