Eclipse Builds COCOS2D-X development environment

Source: Internet
Author: User
Tags pack

Premise: Eclipse is already installed. Ability to develop Android apps normally

Environment: Windows

Tools: 1. ADT's eclipse has been integrated to develop Android applications. No, can download. : http://developer.android.com/sdk/index.html details of the environment to build your own Baidu

The eclipse download is uncompressed without the need for an additional ADT plugin to be able to develop Android apps.

2. Android NDK

3. Cocos2d-x is using a stable version number of V2.2.2:http://www.cocos2d-x.org/download/version#cocos2d-x

Build steps: (if Eclipse is already installed and you can successfully develop Android apps)

1. Install the CDT plugin for Eclipse. Download CDT compression pack: http://www.eclipse.org/cdt/downloads.php after download

Open Eclipse, one click "Help" Install new softwear "ADD"

Popup such as the following dialog box

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvaghoy2nja2tr/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast "style=" border:none; max-width:100% ">

Name take a name: My name is CDT. Click Archive to locate the CDT compression pack that you just downloaded, click OK to enter the following interface:

Tick the first one. Always next after you restart Eclipse.

2. Configure the NDK to compile C + + files. Http://developer.android.com/tools/sdk/ndk/index.html

I use the version number R9. Once downloaded, unzip to the corresponding location. My position is D:\ndk\android-ndk-r9d.

Then, open Eclipse "window" preference "Android" NDK increases the path of the NDK

then click OK.

3. Download the Cocos2d-x package, I downloaded the v2.2.2 version number.

Http://www.cocos2d-x.org/download/version#Cocos2d-x

After downloading, unzip to the corresponding location.

My in: D:\cocos2d

4. Import library file: Open Eclipse "file" import "

Appear For example the following dialog box, click on Android. Click Existing.

。。

Then click Next below to go to the next dialog box. Click Browse on the dialog box, select the cocos2d file that you just extracted, import

Cocos2d-x-2.2.2\cocos2dx\platform\android\java

depending on the location of your decompression, select Import to

After the import, you can see the imported Lib library file in Eclipse "Libcocos2dx

5. Import the sample program. Importing a project is like 4, just importing a different file. Its location is

D:\cocos2d\cocos2d-x-2.2.2\samples\Cpp\SimpleGame D:\cocos2d Create a place for myself to save the extracted files

Please do not tick copy project, and do not copy items into eclipse, there will be problems.

Suppose the project is wrong. May not find the corresponding library file, please click on the project Right button, the bottom right click on the "Android" in the "add" pop-up box, select the above imported library file LIBCOCOS2DX. Click OK

6. Configure Builder. Right click on the project you just imported "properties (most of the following)" In the dialog box that appears, left, click Builders "To remove the front of CDT builder on the right." Such as

And then. Click New "Program" "OK, enter

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvaghoy2nja2tr/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast "style=" border:none; max-width:100% ">

Click "Browse File System button" to select the path location of the NDK installation just now D:\ndk\android-ndk-r9d\ndk-build.cmd (This is my location, Depending on where you are placed. Choose to go in)

Click Working directory below Browse Workplace to select the project you just imported

At last

Then click OK to finish

7. Configure the. mk File

Click on the imported item, click JNI, double-click to open the Application.mk file. Add in, such as the following code:

Ndk_module_path: = D:\cocos2d\cocos2d-x-2.2.2\cocos2dx\platform\third_party\android\prebuilt; D:\cocos2d\cocos2d-x-2.2

Save ( Note that this is the placement path for my cocos2d.) Please fill in your own path, is 2 words, in the middle separated by semicolons )

My cocos2d was unpacked in the cocos2d directory of the D-disk.

8. Increase the resources required for the project

From Catalog--d:\cocos2d\cocos2d-x-2.2.2\samples\cpp\simplegame\resources\hd

Inside, copy the picture inside of the project to the assets inside.

Through the above structure. We will be able to click on the project. Run as. Results of the implementation of the project

Eclipse Builds COCOS2D-X development environment

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.