Building Android app bundles on Cocos2dx 3.17.2

Hi people,
I’m developing a 2d game using cocos2dx 3.17.2
Until now I have compiled debug and release apks, using cocos compile command line:
cocos compile -p android -m release for example.
But now I need to generate android app bundles in order to satisfy the new google requirements to upload apps on the store.

Note: I’m using command line instead of android studio, because I have installed cocos2dx and my game project in a linux virtual machine to keep configuration standard between developers. android studio is just too resource consumming to run eficiently on those virtual machines.

Unfortunatelly. I was not able to find any documentation showing how to generate the app bundle for release or debug.

I tryed to directly use gradlew to compile apks and app bundles. I’ve got positive results generating the apks but not the bundles:

gradlew assembleRelease: BUILD SUCCESSFULL and the apk was build on app/build/output/apk folder.

Same success was achieved using gradlew assembleDebug.

but
gradlew bundleRelease command resulted in BUILD_SUCCESSFUL message bug it was not generated any bundle file.

My questions:

Is there any command line command provided by cocos tools
to generate the app bundle?

Is it necessary any different configuration to generate app bundles on cocos?

Thank you in advance!

1 Like

Updated gradlew and gradle from 4.4 to 6.8 . The apk builds fine and the game runs, But I still can not find any bundle file after running gradlew bundleRelease.

I think I will keep this new version of gradle.

Hi people,

I have finnaly found the problem.

My my gradle plugin was too old and simply did not have the bundle functionality.

I upgraded the wole android compiling environment and now it is compiling apks and bundles with no problem.

My current configuration is the following.

My project is based on cocos 2dx 3.17.2


Gradle 6.7.1 N/A
SDK Build Tools 30.0.2
NDK 21.4.7075529

After the upgrade I also had to change Android.mk file:

LOCAL_MODULE := MyGame_shared

changed to :

LOCAL_MODULE := MyGame

1 Like

Is app bundle required for new apps only or for old apps as well from August 2021?

From August 2021, new apps will be required to publish with the Android App Bundle on Google Play

What changes are required to convert multiple APK build like below Build multiple APKs  |  Android Developers

To android bundle?