Create an Android project in Cocos2d-X

Source: Internet
Author: User

It is not complicated to create the Android project of Cocos2d-X under Windows, the key is to change several environment variables.

1. Go to the Cocos2d-X home directory to modify create-android-project.bat"

Everyone knows you should click "create-android-project.bat" to generate a new project, but you should make some changes according to your environment before running the build wizard.

To adapt to my configuration environment, I made some changes in the create-android-project.bat.

Set_CYGBIN = D: \ cygwin \ bin

This is the path of Cygwin bin.

Set_ANDROIDTOOLS = D: \ android-sdk-windows \ tools

This is the path of android sdk tools.

Set_NDKROOT = D: \ android \ android-ndk-r8e

This is the root directory of ndk.

Now you can run create-android-project.bat to create an android project:

Go to the root directory of the cocos2d-x, double-click the create-android-project.bat, and enter the name of the project and target id. This is simple.

2. Modify "build_native.sh" of the new repair project"

Copy your project to your favorite location, and modify a directory item in "build_native.sh" before compiling C ++ code.

 

 

3. Run "build_native.sh" in cygwin to compile C ++ code

4. Move the project to eclipse

Run your eclipse and click File> New> Project> Android Project to import the Project.

 

Of course, you can also import the project first before proceeding to steps 2 and 3!

5. Compile and run java code

Right-click the Project and select "Build Project"

  

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.