How to create an Android App Bundle on the terminal?

Asked

Viewed 764 times

1

1) Creating and signing android Apks by the terminal has always been relatively easy. But now with the new form "Bundle" I’m catching quite a lot.

today I use the following:

Cordova build android --release

I create the key, and then:

jarsigner zipalign...

and so I create the APK...

2) But for the turning part in . AAB, I have searched the net where I found a lot of things by half or that does not work, Mindorks, SO Eng

For example I have tried to install this "gradlew" but nobody talks about its installation and use. Only that it is necessary. trading in kids after two weeks I’m totally lost...

or be my question eh: How to create an Android App Bundle on terminal ?

thank you.

  • found the answer... in another forum... should delete this post?

1 answer

2


To create "app Bundle" from the command line, when using Cordova for example, just go to the folder where Cordova created "Platform".

In my case it’s in:

/User/Mila/projects/Myapp/Platforms/android

1) Then, run the gradelw that is in this folder, to create the . Aab !!!
simple as that! that is to say:

./gradlew bundleRelease

(remember 1: as I use Ordova, for the gradlew to be properly configured, it is necessary to run the command "Cordova build android", at least once)

(remember 2: in iMac gradlew must have execution/program attribute)

(remember 3: this also already signs the package, ie no longer need to create a signature key with the "jarsigner"!!)

READY take your file . Aab at: /User/Mila/projetos/Myapp/Platforms/android/app/build/outputs/Bundle/release/app-release.Aab

and put it in your favorite folder.

2) I would just like to comment on an important point: to send to google I need to use the zipalign

zipalign -f -v 4 app-release.Aab Myapp-release.Aab

that is, for the complete solution, there are only 2 commands in the terminal!

  • The zipalign is unnecessary if you configure Gradle to sign the app with signingConfigs: https://developer.android.com/studio/build/building-cmdline#gradle_signing

  • really.... the zipalign... eh """needless""".... but... also gives more work by editing the mentioned file... becomes more bureaucratic. REMEMBER also that if, Voce remove that plartaforma (in case android), when create it again should edit the file again.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.