Since cocos2d-x3.0, there is a configuration file called 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.
The first thing to do is to download the cocos2d-x3.0 version, download Android_sdk,android_ndk, and Ant.
When 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.
So just enter Cocos new Helloworld-p com.rm-l cpp-d. command to generate a new project.
After the game is written, a single Cocos Run command can be compiled automatically, packaged into an. apk format and run directly on the available Android devices, and the specific commands are explained below:
Because the SDK version installed on the machine is 20, it needs to be compiled with--ap 20来
Run on the command line:Cocos run–p Android --AP
Turn on your Android phone or virtual machine to see the effect directly.