Window 7 (64-bit) configuration Cocos2d-x-3.6 environment, windows764 Configuration
1, go to the cocos2d-x official website to download the 3.6 version of the compressed package, unzip to an English path.
2. download and install the following software (Baidu ):
(1) Visual Studio2012 or 2013
(2) install java 1.6 or above
(3) eclipse with Android ADT (adt-bundle-windows-x86_64-20140702)
(4) python 2.7.5 (https://www.python.org/downloads)
(5) ANT 1.9.4 (http://ant.apache.org/bindownload.cgi)
(6) NDK (this can download the latest, http://developer.android.com/tools/sdk/ndk/index.html)
3. Configure environment variables as follows:
(1) Add the Android SDK Tool Path to the user environment variable (or system environment variable): ADT_ROOT
For example, the author path is: E: \ adt-bundle-windows-x86_64-20140702 \ sdk \ platform-tools
(2) Add environment variables: ANDROID_SDK_ROOT, such as: E: \ adt-bundle-windows-x86_64-20140702 \ sdk
(3) Add the environment variable ANT_ROOT, for example, D: \ develop_software \ apache-ant-1.9.4 \ bin.
(4) Add the Java environment variable CLASSPATH, for example :.;
Add the Java environment variable JAVA_HOME, for example, C: \ Program Files \ Java \ jdk1.7.0 _ 60.
(5) add ndk path environment variables: NDK_ROOT, such as: D: \ develop_software \ android-ndk-r10d
(6) Add the python environment path PYTHON_ROOT, for example, D: \ develop_software \ Python27.
(7) add Cocos2d-x environment path: COCOS_ROOT, such as: D: \ develop_software \ cocos2d-x-3.6 \ tools \ cocos2d-console \ bin
(8) add all the preceding environment variables in the environment variable PATH, for example:
% JAVA_HOME % \ bin; % JAVA_HOME % \ jre \ bin; % ANT_ROOT %; % COCOS_ROOT %; % ADT_ROOT %; % PYTHON_ROOT %;
% ANDROID_SDK_ROOT %; % NDK_ROOT %;
4. Create a project for cocos2d-x 3.6 by using the command line:
(1) syntax for creating a project: cocos new <gamename>-p <packageidentifier>-l <language>-d <location>
Gamename is the name of the game project.
Packageidentifier: package name
Language: development language (which can be cpp, lua, and js)
Location: the path where the new project is stored
For example, open cmd and enter cocos new HelloWorld-p com. test. helloworld-l cpp-d D: \ cocos2dx_projects.
5. Run the HelloWorld project under win32 platform
(1) Go to the path D: \ cocos2dx_projects \ HelloWorld \ proj. win32.
(2) double-click "HelloWorld. sln" to open Visual Studio2013 automatically.
6. Configure and run the HelloWorld project of the Android platform
(1) Open Eclipse and import the HelloWorld project created above, under the proj. android directory of the project directory
(2) then copy the Cocos2d-x installation path Code (the author path is: D: \ develop_software \ cocos2d-x-3.6 \ cocos \ platform \ android \ java \ src) to the project, such:
The red circle in the figure shows the code added to the project. (Note that the package name must be consistent with this one ).
(3) If the cocos2d-x installation path and the path created by the project are in the same partition, then do not need to do the second step, because the created cocos2d android project has referenced this project by default.
(4) Open cmd and enter the proj. android directory of the HelloWorld project, for example, cd D: \ cocos2dx_projects \ HelloWorld \ proj. android.
Enter build_native.py to compile the C ++ source file (each new project must be compiled once ).
After the compilation is complete, directly connect to the 2.3 system or above for real machine testing (if you want to test the simulator, the system of the simulator must be above 4.03 ).
The effect will not be pasted here, and the light will be turned off at night. There are so many mosquitoes that they can't stand it.
Two additional content:
1. cocos2d Eclipse prompt: please define NDK_ROOT (solve the problem that Eclipse will not automatically compile CPP)
2. If a new cpp file is added, you must manually modify the Android. mk file.