DevOps for Android App Bundles

Avatar

James

Android App Bundle is a new app packaging format from Google for Android applications that dramatically reduces the install size for end users. Traditionally, when building an Android app, one would create one large APK file that all users would receive. When packaging your app in an App Bundle, applications are delivered dynamically to users based on their specific device. This means, the app that is installed is reduced in size by up to 50% with absolutely no code changes! We introduced support last year in Visual Studio 2019 16.3 and Visual Studio for Mac 2019 8.3 to package apps with App Bundles.
 

Shrink Android App Size with App Bundles

 

Truly Smaller Apps

When using the App Bundle format users get only the languages, resources, and architecture for their specific device. This work is done by Google Play and it really reduces your app size based on your compilation settings. Our developers are seeing amazing success using App Bundle. Here is a tweet from our very own Brandon Minnick, who recently updated his app to use App Bundles:

 


 

To learn more about how App Bundle works and how to setup your project, read through the previous post on App Bundle support from Jon Douglas. He shows you how to enable App Bundle in your Android app and how to produce a local archive directly from Visual Studio 2019 and Visual Studio for Mac 2019.

You might be generating your builds with continuous integration with App Center or Azure DevOps. So today, I want to walk you through how to setup and use App Bundles in your DevOps pipeline.

App Center

In September, App Center released official support that automatically detects your project settings. However, if you don’t want to change your project settings or want full control, you can easily adjust build settings to create an APK and AAB file when you build!
 

Build App Bundle in App Center

 
When the build has finished, easily download your files or submit them directly to Google Play for distribution.
Download App Bundle App Center

 
Learn more about how App Bundle support in App Center on their blog.
 

Azure DevOps

If you are building your Android application in Azure DevOps, it takes just a few steps to package your application into an App Bundle. For testing purposes it is recommended to continue building an APK, in addition to an AAB for app store distribution.

The first step is to ensure you have your Keystore available to sign your App Bundle. This can be done by Downloading Secure File task and uploading your Keystore. Additionally, specify a reference name under Output Variables. This will allow you to reference it in the next step through a variable.
 

Azure DevOps download keystore

 
If you are already building your app in Azure DevOps, simply clone your existing “Build Android App” step. Otherwise, add a new Xamarin.Android build task. Here you will specify your Project Path, Output Directory, and Build Configuration. You will need to continue checking the Create app package option. The main difference being that you will want to pass in Additional arguments for the build to package and sign the App Bundle:

Here are the specified Keystore passwords and alias in the Variables section of the build pipeline. As well as the Keystore patch from the name specified earlier. Now, when you build your app, you will have both an APK and an AAB file ready to distribute!
 

Packages from Azure DevOps

 

Optimize and Shrink Your App

For a full breakdown of what App Bundles are and how they work, checkout the full Xamarin Show with Jon Douglas.
 


 
For deeper dive topics, be sure to read the previous blog on Shrinking your Android App Size. Additionally, follow along with all our documentation on preparing your Android app for release.

Avatar
James Montemagno

Principal Program Manager, Mobile Developers Tools

Follow James   

1 comment

Leave a comment

  • Stuart Lang
    Stuart Lang

    Great stuff! I’d love to be able to distribute AAB bundle via AppCenter too, I’m currently building a APK from Azure DevOps, when I switched to AAB I only found out there was an issue (due to a 3rd party) with using AAB in our Play Store Closed Track, so AppCenter is letting us down here.