"Android" cocos2d-x-3.1.1 environment Construction and creation project (Win7 32-bit system)

Source: Internet
Author: User

1. Environment construction

2. Create the Project

2.1 VS2012 Run

2.2 Android Physical Machine run

1. Environment construction

Installation tools:

1.1. JDK

1.2. Android SDK

1.3. Android NDK

1.4, Apache-ant

1.5. Python

1.6 coco2d-x-3.1.1

1.1. JDK Installation and configuration

Reference: http://jingyan.baidu.com/article/6dad5075d1dc40a123e36ea3.html

1.2 Android SDK Installation

Adt-bundle, contains basic Android development configuration, can be used directly,: http://developer.android.com/sdk/index.html

1.3 Android NDK Installation

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

1.4 Apache-ant Installation

: http://ant.apache.org/bindownload.cgi

1.5 Python Installation and configuration

: https://www.python.org/download/

After you install Python, you need to add the Python installation directory to the system environment variables:

After the configuration is complete, enter Python in DOS to output Python version information and use Python:

1.6 coco2d-x-3.1.1 Installation and configuration

coco2dx:http://cn.cocos2d-x.org/download/

All the files that need to be installed are as follows:

Coco2dx+ant

Android SDK +NDK

Description

The configuration of the COCO2DX 3.1 version differs from the previous version in the following configurations:

Run the setup.py file

Configuration Required:

    • Cocos_console_root:cocos Console path for new, build, and release projects.
    • NDK_ROOT:NDK root directory
    • ANDROID_SDK_ROOT:SDK root directory
    • Ant_root:ant root directory

Each part is configured as shown

View configuration results: (Dos set command to configure, view, delete environment variables)

Environment variables configured with setup.py are added in variables such as:

2. Create the Project

COCO2DX 3.1.1 uses the Cocos2d-console tool to create and build the project, which provides several features:

    • New to create a project
    • Compile compiling the current project, generating a binary file
    • Deploy the release program to a platform
    • Run compiles and publishes, and runs the program

2.1 Creating the COCO2DX project:

Enter Cocos new project name under DOS-P package name-L cpp-d Storage Path

After executing the command, build the HELLOCOCOS2DX project file under the E:\Workspace\EclipseAndroid directory, such as:

For convenience, the command to create a project is written as a batch file:

Create a new txt text, open, copy the following code into the text

  1. @echo off
  2. set/p projectname=please Input Project name:
  3. set/p packagename=please Input Package Name:
  4. @echo Cocos New%projectname%-P%packagename%-L cpp–d E:\Workspace\EclipseAndroid
  5. Cocos new%projectname%-P%packagename%-L cpp–d E:\Workspace\EclipseAndroid
  6. @echo Create Success!!!
  7. Pause

Save and rename to Create_project.bat, put in Coco2dx-console\bin directory D:\Android\coco2dx\cocos2d-x-3.1.1\tools\cocos2d-console\bin , in the future to create a project, directly open, enter the project name and package name, Project storage path I default is E:\Workspace\EclipseAndroid, you can modify:

2.2 VS2012 Run the COCO2DX project:

Enter Proj.win32 under the HELLOCOCO2DX directory of the newly created project

Open the HelloCocos2dx.sln project file

VS2012 Compile and run:

2.3 Build Android Project:

There are two ways to generate the APK file:

Way One: Cocos compile

Execute Cocos compile–p android–j 4 under the HELLOCOCOS2DX directory

The following message appears, indicating a successful compilation, which can be viewed in hellococos2dx\public\android the generated apk file

Mode two: Eclipse compilation

Open Eclipse Settings SDK with NDK

Import Project: Hellococos2dx\proj.android

After importing, if the following error occurs, you did not import the Cocos2d-x package into the Eclipse project:

The LinkSource method is to open the build path for the item purpose, open the:

Set LinkSource linked folder location to D:\Android\coco2dx\cocos2d-x-3.1.1\cocos\platform\android\java\src

Then compile the project and set it to run on the physical machine.

"Android" cocos2d-x-3.1.1 environment Construction and creation project (Win7 32-bit system)

Related Article

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.