Reduce Android App Bundle Size (.aab Files)
The process of reducing the android app bundles, includes both performance acceleration and reducing binary size so the experience on lower end devices would be fluent as possible.
This can reduce the app on device size by up to ~35%.
Building and distributing applications with App Bundle enables a group of new features.
Google Play's Dynamic Delivery uses your Android App Bundle to build and serve APKs that are optimized for each device configuration.
This means your users enjoy a smaller app download without the unused code and resources needed for other devices.
From Android Mobile SDK 11.3.3
In order to enjoy the App Bundle reduction, Google requires that the first version of your Google Play application, be published to production through the Google console.
Only consequential builds, after this first publication, shall be subject and enjoy the App Bundle reduction.
2) Following the Google and Microsoft guides
Once done, please follow THIS GUIDE created by Microsoft, to connect AppCenter with your Google Play store account.
This guide will lead you through:
- Linking your Google Play Console to a Google API project
- Setting up API Access Clients
- Including the Creation of a Service Account
- Create the Configuration Service JSON which contains the Private key
- Connect App Center with Google Play
- Set up Signing by Google
- Create a Google Play connection in App Center
- Publish your APK to the Google Play Store
Please feel free to consult also the Google Documentation on how to create the Google Service JSON.
The Main Steps are the following:
*Disclaimer: Since the Google Play Store and App Center are NOT Applicaster services, they might change the way configurations are carried out, without previous notice and at their own discretion. Therefore, while the Applicaster documentation is very detailed, it is always recommended to read the documentations provided by Google and Microsoft App Center, and regard them as the sole source of truth.
i- Open the Google API Access Console using your Google Account Credentials: https://play.google.com/apps/publish/#ApiAccessPlace (Note that the Google Service JSON file, once obtained, shall be valid on an Account Level, and thus useable for all Apps under this account)
ii- Click on "API Access" from the Side Menu, and then press on the "Create Service Account" on the bottom of the screen:
iii- A popup screen shall appear. Clicking on "Navigate to the Google API Console" in the popup, shall redirect you to the Service Accounts Screen, relevant for your Google Account:
iv- Make sure you have "Service accounts" selected in the Side Menu, and then click on the
"+ CREATE SERVICE ACCOUNT" button, located at the top of the screen:
v- In the page that opens, insert the Service Account Name and Service Account Description, and then click on "CREATE"
vi- Set your role as "Owner" and click on "Continue"
vii- Now that the Service Account has been created, click on the "+ CREATE KEY" button:
viii- Select "JSON" and click "CREATE".
A file with the
.json extension will download to your system.
This file will be used in App Center to establish the connection to Google Play.
This file will be used in Zapp to enable the creation of bundles of type
ix- Once you've created the service account on the Google Developers Console, click "Done". The API Access page automatically refreshes, and your service account will be listed.
x- Close the window and the new service account shows on the original page. Click the "Grant Access" button to complete the process. In the next section, you will learn how to connect App Center with Google Play.
3) Setting Up Signing in the Google Play Console
- Enter the Google Play Developer Console and select your App
- Expand Release management in the left-hand menu
- Select App signing
- You can choose between three options:
- Upload a key exported from Android Studio
- Export and upload a key from a Java keystore
- Export and upload a key (not using a Java keystore)
- Click on "FINISH"
Once App Signing has been established, the App Signing screen in Google Play shall appear as below, and display the App signing certificates:
4) Connecting App Center with Google Play
Once you have obtained the Google Service JSON proceed to use it in order to Connect AppCenter with Google Play:
i- Enter AppCenter (https://appcenter.ms/apps), and Locate your Android App in AppCenter and select "Distribute" --> "Stores" from the side menu:
You will see the Following screen:
ii- Click on "Connect to Store", and then select "Google Play" from the Popup Menu:
iii- Upload the Google Service JSON file, you have previously created via the Google API Console, and click on "Connect":
After a few moments, you will see the different Google Play release tracks, indicating that the connection has taken place, and that AppCenter is now prepared to push the bundles to Google Play:
5) Creating a Release build in Zapp with support for .aab reduced bundle
Once AppCenter and Google Play have been connected, you can proceed to create your .aab (Android App Bundle) build via Zapp:
i- Select "Debug & Release" for your app in Zapp
ii- Insert the Google Service Account Key JSON:
iii- Click on "Build"
6) Locating your Build in the App Center and Google Play Beta tracks
Once the build has been completed, you will now see that the .aab (Android App Bundle) file will automatically appear:
i- In AppCenter as an Alpha Track (only!)
*Please notice that the "Alpha" track in Google Play, is a Closed track available for a specific group of Testers. It is possible to move a bundle from a Closed Track to an Open track, but not the other way around (ie: The Bundle can Only be moved from Alpha to Beta, and from Beta to Production, but Not downgraded from "Beta" to "Alpha").
ii- It will also appear automatically in the Artifact Library of your Google Account (where you will be able to click on the Download button and already download from there the .aab file)
iii- In Addition, the .aab build will be Automatically populated in the Alpha Track of your Google Play account:
* Google supplies a CLI tool that enables local emulation of this behaviour. (information can be found at the bottom of the Guide by Microsoft)
8) Downloading the .aab file from Circle CI to your Local device -
An additional added beneficial capability apart from the Automation process described above, is the fact that when creating a Release build with the utilisation of the Google Service JSON, the .aab file is also generated in parallel and stored under the "Artifacts" section of your Release build in Circle CI.
This means that upon the successful completion of a release build, you will be able to:
i- Access the Circle CI parameters of your version by clicking on the "Green Checkbox" button on the desired Release version, and then click on "Go to Build".
This will launch the Circle CI console, in a new Tab of your Browser
ii- Once inside Circle CI, select the "Artifacts" Tab.
iii- Once inside the "Artifacts" Tab, proceed down the Arifact Hierarchy Tree, untill you reach your .aab file:
- Container -->
- Artifacts -->
- Outputs -->
- Bundle -->
- mobileGoogleZappRelease/ -->
iv- Click on the .aab file, and it will start downloading Locally do your computer/device:
From here, you can proceed to upload the .aab file Manually to any track you'd like, in the Google Play Store.