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