cocos2d-x2.2.3 and Android platform Environment building

Source: Internet
Author: User

Preparation: 1. I'm just porting the Cocos2d-x to the Android platform, so the Android platform is already set up by default (Eclipse and Android SDK are already configured and the Java environment is well built)

2. Download Android DNK, I am using android-ndk-r9d-windows-x86_64, my is 64-bit system

3.cocos2d-x and Android NDK unzip to their designated path

Download the necessary software to try to transplant to the Android platform, we take the Cocos2d-x catalog in the project project as an example, the approximate steps are as follows


1. Configure the Android NDK operating environment. Open ECLIPSE-->WINDOW-->PREFERENCES-->ANDROID-->NDK, configure the installation path of your native NDK;

2. Import Cocos2d-x's Android dependency project in its own eclipse (not sure if this is true), my practice is to file->new->other->android->android project From Existing Code, import Cocos2d-x and Android-related projects, my path is: D:\cocos2d-x-2.2.3\cocos2dx\platform\android\java, This will allow you to use the project as a dependency on other Android projects.

3. Import case Engineering, in Eclipse, file->new->other then select Andriod Project from Existing code in the import projects in the root directory of path D : Project import under the \cocos2d-x-2.2\cocos2d-x-2.2\projects\helloworld\ directory, do not tick copy project into workspace (not checked by default), It is said that the path problem is very troublesome, so in order to avoid unnecessary trouble, do not choose.

PS: Right-click on the imported project at this point, and you will see that the Library section is the project that was imported in the previous step of->properties->android:

4. Copy all files from the resources in the example project (D:\COCOS2D-X-2.2.3\SAMPLES\CPP\HELLOCPP) to the assets directory in the Android project directory

This should be considered as an initial import of the sample project, but will report a lot of errors, because there is no way to set up the compilation.


5. Right-click on Android Project->properties->builders->new->program,

Under the Main tab, under Location, select Browse File Systerm ... and select the Ndk-build.cmd files below the Android NDK.

Working Directory, select Browse Workspace ..., select this project.

Under the Environment tab, click New,


Value:d:/cocos2d-x-2.2.3;d:/cocos2d-x-2.2.3/cocos2dx/platform/third_party/android/prebuilt (pay attention to your own actual directory)

Select OK to confirm, return to the Builders interface, remove the tick in front of the CDT builder, and move the builder you just created to the top, all configured OK to confirm.

6. View the file under the JNI directory under the Android project, where Local_src_files: you need to fill in all the. cpp files in your Cocos2d-x project (this comes with the demo already written, if you develop your own project later , remember to fill in the sections that are good):

7. Should now be able to connect the mobile phone run try it, try to use the test machine, the simulator is not good, if there is no problem, the general first compile to go through a little longer period of time, you can see this test demo running effect.

cocos2d-x2.2.3 and Android platform Environment building

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: 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.