Build Cocos2d-x V3.2RC0 development environment under Win7 (for Android)

Source: Internet
Author: User

Cocos2d-x is currently the most popular game engine for most game development enthusiasts love,

Therefore, the purpose of this article is to teach novice how to establish COCOS2DX development environment under Win7,

As of this article, the latest version of COCOS2DX is V3.2RC0, and I will assume that your development

The VS2012/VS2013 integration tool is already included in the environment (the IDE downloads and installs relatively simple,

No installed friends can go to Microsoft Official download installation), with the tool, then

Start our game Environment Building tour ...


First, the following tools are required to build the development environment:

1.Visual Studio 2012/2013 (Microsoft IDE Development tools)

2.cocos2d-x V3.2RC0 version (game development engine)

3.JAVA JDK (JAVA Development Kit)

4.python Tools (for script compilation)

5.ADT Package (version of Eclipse IDE with Android SDK components and a built-in ADT (Android Developer Tool)

6.Android NDK (So and Java apps packaged as APK)


First, to the Chinese official website to download cocos2d-x v3.2rc0 version,

Portal :http://cocos2d-x.org/download

After the download, we directly unzip, you can get the main directory (this article related software I all extracted to g:\),

Then go into the G:\cocos2d-x-3.2rc0\build, open Cocos2d-win32.vc2012.sln with VS2012,


It is important to note that the default platform toolset is V110_XP, and if we are using the Win7 platform, change it to Visual Studio (v110),


After that, we change the startup item to Cpptest and then build the solution ...


After compiling successfully, we press F5, we can start successfully, and then see the following screen:


Two. Installing the configuration Java JDK

Because we want to be able to migrate to the Android platform, the Java JDK is a must, and it is recommended to use the 64bit JDK for Windows.

Portal: http://www.oracle.com/technetwork/java/javase/downloads/index.html

After the download is complete, install it, the local path is: G:\Java\jdk1.8.0_05


To configure user environment variables:

1. Create a new user variable:

Variable name: Java_home variable Value: G:\Java\jdk1.8.0_05
Variable name: CLASSPATH variable value:.; %java_home%\lib; (note number)


To configure the system environment variables:

2. Continue adding after the system variable:
System variable Name: Path variable value:;%java_home%\bin

Here, the environment variable is configured.


Then enter java-version in the DOS window

(Run->cmd or win+r at start)

If you see the following screen, the installation is successful:


Three. Download the ADT package and configure the Android SDK environment

The ADT package contains an IDE development tool called Eclipse, which also contains the Android SDK, and the built-in ADT development tool acts to make

Eclipse is able to use the Android SDK component (the equivalent of a bridge),

Portal: http://developer.android.com/sdk/index.html

(May be wall, I used a proxy server to go smoothly)

To configure user environment variables:

Variable name: ANDROID_SDK variable value: G:\adt-bundle-windows-x86_64-20140624\sdk\platforms; G:\adt-bundle-windows-x86_64-20140624\sdk\tools; G:\adt-bundle-windows-x86_64-20140624\sdk\platform-tools;

Variable Name: PATH variable Value:%android_sdk% (if present continue to add, remember to separate with semicolons)


Then enter the Adb-h test in the DOS window under CMD to see if the installation was successful.


Four. Download and install the Python tool

The version here is python2.73,

Portal: https://www.python.org/download/releases/2.7.3/

1. Download and install the python2.73.

The path of this machine is G:\Python27,


To configure user environment variables:

Variable name path variable value: G:\Python27 (continue to add after, remember to separate with semicolons)


Enter Python in the DOS window under CMD, as shown to indicate that the installation was successful:


Five. Configure the Android NDK installation

To download and install the Android NDK first, it is recommended to use Windows 64-bit, the native path is: G:\android-ndk-r9d,

Portal: http://developer.android.com/tools/sdk/ndk/index.html


To configure user environment variables:

Variable name: Ndk_root variable Value: G:\android-ndk-r9d

Variable Name: PATH variable Value:%ndk_root% (added from existing, remember to separate with semicolons)


Six. Create a build COCOS2DX project.

Enter the G:\cocos2d-x-3.2rc0\tools\cocos2d-console\bin directory in the DOS window under CMD,

And then enter

Python cocos.py new beyondtest-p com.cocos2dx.org-l cpp-d beyond

Create project projects with the cocos.py script:

Parameter description:

    • Test is the project name
    • -pAfter the package name
    • -lfollowed by the development of the language type, there are CPP, LUA, JS three types
    • -dThe directory after which the project is stored

Then go into the G:\cocos2d-x-3.2rc0\tools\cocos2d-console\bin\beyond\beyondTest\proj.android directory,

Enter Python build_native.py under DOS to compile the build_native.py script,


Seven. Test run the COCOS2DX project with a real machine.

1. Open Eclipse, set the path to the Android NDK (select Windows->preferences->ndk)

(Note: The first time you start Eclipse, an instant dialog box will appear, requiring the default workspace (workspace) to be set.)

You can choose the default setting, or you can set it to your own needs (I set it to G:\Java\workspace))



2. Click the right mouse button in the Project Explorer blank and select Import ...

3. Select exiting Android Code into WorkSpace and click Next.


4. Browse the directory as G:\cocos2d-x-3.2rc0\tools\cocos2d-console\bin\beyond\beyondTest\proj.android,

then click Finish.


5. An error was found when importing, because of a lack of Java org.cocos2dx.lib,

(Windows->show View->problems can display this interface)


6. We will overwrite the org file in the G:\COCOS2D-X-3.2RC0\COCOS\PLATFORM\ANDROID\JAVA\SRC directory to

G:\COCOS2D-X-3.2RC0\TOOLS\COCOS2D-CONSOLE\BIN\BEYOND\BEYONDTEST\PROJ.ANDROID\SRC directory,

Then re-import the Beyondtest project, and then we can see that the error disappears:


 Real-Machine testing
1. Connect the phone with the Android system using USB, then right-click the project, or select Run in the menu,
Then click Run as->android application to enter the following screen (you can see that my Android version is still 2.3.4,
But do not affect the result ^0^), select after click OK, you can successfully run on the real machine.




after the last successful run:

Build Cocos2d-x V3.2RC0 development environment under Win7 (for Android)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.