Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build Android App bundle from the command line

My APK file is already signed (with jarsigner) and compressed (with zipalign). I do it via a bash script. Though I'm getting a warning in Play Console to use Android App Bundle:

Reduce the size of your next release using the Android App Bundle. Your app could be 15.4% smaller if you used the Android App Bundle.

I know I have to use bundletool to use it in command line. The documentation is though too long and cumbersome.

Imagine I have such a file myApp.apk (already signed and compressed). Which command should I run to have the Android App Bundle file to upload to Google Play Console?

like image 577
João Pimentel Ferreira Avatar asked Jul 12 '26 00:07

João Pimentel Ferreira


2 Answers

It's very simple. You can create android app bundles (.aab) file from android source by this command :

gradlew bundle

OR

gradle bundle
like image 71
emamie Avatar answered Jul 14 '26 12:07

emamie


You cannot simply convert an APK to an App Bundle. You have to use a build system that supports building App Bundles from source, like Android Studio (which uses Android Gradle plugin) or others.

Bundletool has a build-bundle command but it is meant to use by build systems since you need already precompiled dex code, and resources compiled in a proto format.

like image 28
Pierre Avatar answered Jul 14 '26 14:07

Pierre



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!