Two commands let the cocos2d-x project run on android, cocos2d-xandroid

Source: Internet
Author: User

Two commands let the cocos2d-x project run on android, cocos2d-xandroid

Since the cocos2d-x3.0, there is a configuration file named setup. py in the directory. Running it can help us quickly configure the necessary environment variables: cocos2d-x command line path, android_sdk path, ant_root path, android_ndk path.

First of all is to download the version of the cocos2d-x3.0, download android_sdk, android_ndk, and ant.

After the environment variable configuration is complete, we can start our new project.

We use the cocos new command to generate a new cocos2d-x project.


Therefore, you only need to enter the cocos new HelloWorld-p com. rm-l cpp-d. Command to generate a new project.


After the game is compiled, only one cocos runcommand can be compiled automatically, packaged into A. APK format, and run directly on available android devices. The specific commands are described as follows:


Because the sdk version installed on the machine is 20, you need to use -- ap 20 for compilation.

Run cocos run-p android -- ap 20 in the command line.

Turn on the android phone or virtual machine to see the effect.



Android projects for COCOS2D-X

Use vs2012 or vs2010 to open the corresponding cocos2d-win32.vs2010.sln or vs2012
Generate a solution
Run template \ msvc in the cocos2d directory after generation
InstallWizardForVS2010.js
You can add a cocos2d project in vs2010.
After compilation, use cygwin cross-platform transfer to generate the installation package using android compiling software.
Do not use windows notepad for the configuration file. bat in cygwin.

Teach you a question about porting android to the lua project in cocos2d-x

Build_native.sh




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.