At last, I started to fully invest in cocos2dx development. I have accumulated a lot before, but all of them are based on 2.2.2. the 3.1.1 version also came out for a while. It should be mature. I will try it today. One of the biggest changes is that cygwin is not needed, and ndk is used directly. Select and install python, ant, ndk, and andoroid sdk.
Similarly, set three environment variables, such as ANDROID_SDK_ROOT, ANT_ROOT, and NDK_ROOT, which are somewhat different from the previous ones.
Download cocos2dx 3.1.1 and decompress it. Here I decompress it to G: \ cocos2dx \ cocos2d-x-3.1.1. Run setup. py, which sets the environment for cocos running dependencies. 3.1.1 use \ tools \ cocos2d-console \ bin \ cocos. py to create a project. After you run setup. py, cocos. py is added to the PATH, which can be directly input as a command.
To simplify the creation, I wrote a batch processing name here, which is the project name. To create a batch processing name, you only need to change it. There are no restrictions on the batch processing location. You can change the target directory and package name.
The batch name here is MyTest. bat.
Cocos new % ~ N0-p com. zdhsoft-l cpp-d g: \ cocos2dx \ cocos3
Then press G: \ cocos2dx \ cocos3 \ MyTest \ proj. win32 \ MyTest. sln to compile and run an empty cocos2dx.
Similarly, in G: \ cocos2dx \ cocos3 \ MyTest \ proj. android runs build_native.py, double-click it, and then runs ant debug to get an apk, which can be run on the mobile phone.