Working with cocos2d-x and Android Studio

Recently, started a new game project with cocos2d-x 3.17.2 and Android Studio 3.5. The environment changes are so huge and I am struggling in finding out how to add a new cpp file in the project and build.

Previously, I had to add my new cpp file names in the “Android.mk” file under “proj.android/app/jni”. But this did not work anymore. After lots of googling, I found a hint for this.

https://docs.cocos2d-x.org/cocos2d-x/v3/en/installation/CMake-Guide.html

I checked the “gradle.properties” file and found the “PROP_BUILD_TYPE” is set to “cmake”. This means, I have to edit the “CMakeLists.txt” under the project root directory.

I added my new file name in the “CMakeLists.txt” and the build just succeeded. Happy!!