Publish smaller apps with the Android App Bundle
The Android App Bundle (.aab) is a new upload format that includes all of your app’s compiled code and resources, but defers APK generation and signing to Google Play at install time.
Google Play does this through a new app serving model called Dynamic Delivery, this uses your app bundle to generate and serve an optimized APK for each user’s unique device configuration, so they download only the code and resources that are needed to run the application.
This eliminates the need to have to build, sign, and manage multiple APKs based on their ABI, locale, screen size, and more. Additionally, you can use dynamic feature modules to define what feature modules and resources that users first download when they install your application.
Using Android App Bundles increases the app size limit to 150MB without having to use those pesky APK expansion files. One of the many benefits you get when using Android App Bundles.
As your application size increases, so does the complexity of your application. Your users may run into problems such as:
- Slower downloads
- Decreased installation rates
- Increased uninstall rates
- Non-supported device APKs
Instead, you can gain the benefits such as:
- Faster downloads
- Increased installation rates
- Decreased uninstall rates
- Serve users functionality and configurations on demand
- Simplify your build and release management by removing the need to publish multiple APKs
If you’re curious on how this will impact your Android application today, check out these App Bundle Size Savings.
We wanted to see the benefits this would have on Xamarin, and to our surprise we saw some magnificent results!
Here we have an APK that was 39.4MB using a traditional upload to Google Play. After creating an Android App Bundle instead, we cut our app download size to 23.3MB! That’s a decrease of over 35%!
To build app bundles and support Dynamic Delivery, you can follow these steps:
- Download Visual Studio 16.4 or higher on Windows or Visual Studio for Mac 8.4 or higher on Mac.
- Prepare your application for
- Build an Android App Bundle using Visual Studio. If you’re not using an IDE, you can instead build an app bundle from the command line.
- Enroll into app signing by Google Play
- Publish your app bundle to Google Play.
Build and deploy Android App Bundles
App bundles differ from APKs as they cannot be deployed directly to a device. Rather, it’s a format that is intended to be uploaded with all of your compiled code and resources. After you upload your signed app bundle, Google Play will have everything it needs to build and sign your application’s APKs and serve them to your users using Dynamic Delivery.
If you’re using Visual Studio, you can build your project as a signed app bundle in just a few clicks. If you’re not using the IDE, you can instead build an app bundle from the command line.
To enable support for Android App Bundles, you’ll need to opt-in to the
bundle value of the Android Package Format property within your Android options. As you do this, ensure you change your project to a
Release configuration as app bundles are intended for release packages only. To do this you can follow these steps:
- Right click your project, and select
- Navigate to
- Change your configuration to
- Change the Android Package Format to
After you’ve completed these steps, you can generate an app bundle by right clicking your project and selecting
Archive. This will generate an app bundle for your application.
Test your app bundle
After you’ve created your Android App Bundle, you can test how Google Play will generate the respective APKs when deployed to a device. To test your app bundle, you may try to:
- Test your Android App Bundle locally using bundletool which generates APKs from your app bundle and deploy them to a connected device.
- Share your application with a URL. You can share your app as a Google Play Store link with your trusted testers.
- Set up a custom delivery. You can customize your delivery options based on who you want to test your app.
For more detailed information on Android App Bundles, please see Google’s documentation on Android App Bundles.
With just a few clicks, you can upload your Android App Bundle to Google Play today and give your users the gift this holiday season of a smaller, optimized, dynamic APK for their devices!
We encourage your feedback on any issues to be reported via the Report a Problem option found in your favorite IDE via Help > Report a Problem. If you have any questions regarding Android App Bundles, please post them on the Xamarin Forums or Stack Overflow.
we have bad experience with AAB. Yes, the size of the application is smaller, but dramaticaly increases startup time. Our .APK file startup time with Xamarin.Forms: 7s, but .AAB was 13s. It looks like .AAB destroys the AOT compiling.
Any idea how to solve this problem?
I got on board with Xamarin development because of their promise to be able to create anything with the platform that can be done natively. They delivered on that promise by making any features developed by either google or apple available very shortly after publishing. This aab feature is incomplete in Xamarin, and has been for at least 9 months. Xamarin supports android app bundles in the simplest case only, and leaves it to the developer to read the fine print to discover that instant apps and dynamic feature delivery are not implemented.
Unfortunately, that is how it has always been with software. They start supporting an initial feature, and over time, it gets better. I started on Xamarin in the first beta of their iOS Monotouch product in 2009, and it’s been that way since.
Any update on how to implement dynamic feature module, i cant find any documentation to understand how it needs to be implemented in Xamarin. Thanks!