cocos2dx team made a great progress on gradle for Android studio in 3.15.1. I tried some options till I found, how to get the new gradle building system in Android studio up and ready for my old 3.11 project:
Migration:
I had a 3.11, so I updated all directories (copy/paste of cocos2d directory) and wanted to use the new gradle, so:
I created a new cocos2dx project
cocos new newProject -p xx.company.area.Project -l cpp -d /Users/xxx/Development/temp
where newProject is exactly the same project name as the old one, also package name is the same - but stored in a temp directory
tar-ed the proj.android-studio to not miss hidden (starting with “.”) files:
cd newProject/proj-android-studio
tar cvfz content.tar.gz . -----> use “.” not “*” !!!
cd oldProject/proj.android-studio
rm -rf *
mv newProject/proj.android-studio/content.tar.gz oldProject/proj.android-studio/
cd oldProject/proj.android-studio/
tar xvfz content.tar.gz
edit oldProject/.cocos-project.json, where I set 3.15.1 as a version
Configuration:
After opening of a project in Android studio:
Build => Edit build types => Signing
I entered data to the signing certificate
Build => Edit build types => Build Types
I selected “release” for Signing Config
Build => Build variants
I changed “debug” to “release”
Run/build your project and the APK file will be created in
/oldProject/proj.android-studio/app/build/outputs/apk/oldProject-release.apk
If your project is in GIT, you will see changes in some IDEA files and in /oldProject/proj.android-studio/app/build.gradle
That’s it, for me everything is working out of Android studio…
entering data of certificate (stored then in /oldProject/proj.android-studio/app/gradle.properties
but build from a console and from Android studio worked differently for me, so now I work in Android studio only