Publishing to Google Play Store (APK and AAB Files)

friday Emmanuel chigozirim
LearnFactory Nigeria
4 min readJul 11, 2022

Hello guys i will we guide you on how you can deploy your application on Google play store, after you must have finished your development stage, most time you may be at the development stage and your client or boss demands to see how the application looks like, there is no need to worry about it, the solution is all here with you on this article, let’s get started

in this article will show you two different things on deploying your application to the Google play store, the first one is the normal .apk file which runs on your android phones and the second one is the .aab file, having listed these two things i will like to explain the .aab file, i believe you already know what .apk is all about and how it works,

What is an AAB? An Android App Bundle is a publishing format that includes all your app’s compiled code and resources, and defers APK generation and signing to Google Play.

Generating an upload key

first we have to generate an upload key which will enable our application run and stay safe. ti generate this key you have to run the following command on the terminal

your output will have the following

Setting up Gradle variables

second is to set up your gredle variables which are the keystore password you entered for example if your code is #2763989!! replace it with the *******

  • Place the my-upload-key.keystore file under the android/app directory in your project folder.
  • Edit the file ~/.gradle/gradle.properties or android/gradle.properties, and add the following (replace ***** with the correct keystore password, alias and key password),

Adding signing config to your app’s Gradle config

The last configuration step that needs to be done is to setup release builds to be signed using upload key. Edit the file android/app/build.gradle in your project folder, and add the signing config,

all you need to do is to replace the debug file with the release file and it must come before the buildType

If you have gotten to this stage congratulation you have almost made it to the finial stage, let’s fix up few things and call it a done deal. The next thing that will be on your mind is what next how will this program run? and all that, the next step or stage you are about entering is the core base known as the Generating the release APK, but at this point i will be showing you the .apk and the aab format one after the order, so which ever one you want to use you can apply it, let’s complete our task

Generating the release APK

Run the following in a terminal: you first cd into your android path

Gradle’s bundleRelease will bundle all the JavaScript needed to run your app into the AAB (Android App Bundle). If you need to change the way the JavaScript bundle and/or draw-able resources are bundled (e.g. if you changed the default file/folder names or the general structure of the project), have a look at android/app/build.gradle to see how you can update it to reflect these changes.

Generating the release APK

Testing the release build of your app

Before uploading the release build to the Play Store, make sure you test it thoroughly. First uninstall any previous version of the app you already have installed. Install it on the device using the following command in the project root:

this will generate the apk file for you and it’s always big in size and it will compile all the codes and different phone architecture all at once and build them inside one, while the .aab file will generate codes and different phone architecture and build them separately that it will determine your phone architecture and install it only for you where by making the size smaller, but the same content with the bigger file .

so guys at this point you are set and can send your application to your boss or clients to view it. To locate this .apk and .aab you can always see them on, if you still want to test it and see you can run the following command on your terminal

Note that --variant=release is only available if you've set up signing as described above. You can terminate any running bundler instances, since all your framework and JavaScript code is bundled in the APK’s assets.

.aab android/app/build/outputs/bundle/release/app.aab

.apk android/app/build/outputs/bundle/release/app.apk

Thank you for your time, hope this material was useful to you? you can drop your questions and comments. thanks, do well to follow me up on my twitter handles and email me

twitter account: @friday273
email: fridayemmanuel273@gmail.com

--

--