{"id":46009,"date":"2019-12-27T12:04:11","date_gmt":"2019-12-27T20:04:11","guid":{"rendered":"http:\/\/devblogs.microsoft.com\/xamarin\/?p=46009"},"modified":"2019-12-27T11:34:28","modified_gmt":"2019-12-27T19:34:28","slug":"android-app-bundle","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/xamarin\/android-app-bundle\/","title":{"rendered":"Publish smaller apps with the Android App Bundle"},"content":{"rendered":"<p>The Android App Bundle (.aab) is a new upload format that includes all of your app&#8217;s compiled code and resources, but defers APK generation and signing to Google Play at install time.<\/p>\n<p>Google Play does this through a new app serving model called <em>Dynamic Delivery<\/em>, this uses your app bundle to generate and serve an optimized APK for each user&#8217;s unique device configuration, so they download only the code and resources that are needed to run the application.<\/p>\n<p>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 <em>dynamic feature modules<\/em> to define what feature modules and resources that users first download when they install your application.<\/p>\n<p>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.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-46010\" src=\"http:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/12\/AppBundles.png\" alt=\"Android App Bundle\" width=\"955\" height=\"516\" srcset=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/12\/AppBundles.png 1720w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/12\/AppBundles-300x162.png 300w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/12\/AppBundles-1024x553.png 1024w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/12\/AppBundles-768x415.png 768w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/12\/AppBundles-1536x830.png 1536w\" sizes=\"(max-width: 955px) 100vw, 955px\" \/><\/p>\n<h2>Size Savings<\/h2>\n<p>As your application size increases, so does the complexity of your application. Your users may run into problems such as:<\/p>\n<ul>\n<li>Slower downloads<\/li>\n<li>Decreased installation rates<\/li>\n<li>Increased uninstall rates<\/li>\n<li>Non-supported device APKs<\/li>\n<\/ul>\n<p>Instead, you can gain the benefits such as:<\/p>\n<ul>\n<li>Faster downloads<\/li>\n<li>Increased installation rates<\/li>\n<li>Decreased uninstall rates<\/li>\n<li>Serve users functionality and configurations on demand<\/li>\n<li>Simplify your build and release management by removing the need to publish multiple APKs<\/li>\n<\/ul>\n<p>If you&#8217;re curious on how this will impact your Android application today, check out these <a href=\"https:\/\/developer.android.com\/platform\/technology\/app-bundle#size-savings-because-of-dynamic-delivery\">App Bundle Size Savings<\/a>.<\/p>\n<p>We wanted to see the benefits this would have on Xamarin, and to our surprise we saw some magnificent results!<\/p>\n<p>Here we have an APK that was <strong>39.4MB<\/strong> using a traditional upload to Google Play. After creating an Android App Bundle instead, we cut our app download size to <strong>23.3MB<\/strong>! That&#8217;s a decrease of over 35%!<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-46011\" src=\"http:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/12\/AppBundleSizeSaving.png\" alt=\"Creating an Android App Bundle cuts your app download size\" width=\"877\" height=\"304\" srcset=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/12\/AppBundleSizeSaving.png 1697w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/12\/AppBundleSizeSaving-300x104.png 300w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/12\/AppBundleSizeSaving-1024x355.png 1024w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/12\/AppBundleSizeSaving-768x266.png 768w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/12\/AppBundleSizeSaving-1536x532.png 1536w\" sizes=\"(max-width: 877px) 100vw, 877px\" \/><\/p>\n<h2>Getting Started<\/h2>\n<p>To build app bundles and support Dynamic Delivery, you can follow these steps:<\/p>\n<ol>\n<li>Download Visual Studio 16.4 or higher on Windows or Visual Studio for Mac 8.4 or higher on Mac.<\/li>\n<li>Prepare your application for <code>Release<\/code><\/li>\n<li>Build an Android App Bundle using Visual Studio. If you&#8217;re not using an IDE, you can instead <a href=\"https:\/\/docs.microsoft.com\/en-us\/xamarin\/android\/release-notes\/9\/9.4#initial-support-for-android-app-bundle-publishing-format\">build an app bundle from the command line.<\/a><\/li>\n<li><a href=\"https:\/\/support.google.com\/googleplay\/android-developer\/answer\/7384423\">Enroll into app signing by Google Play<\/a><\/li>\n<li><a href=\"https:\/\/developer.android.com\/studio\/publish\/upload-bundle\">Publish your app bundle to Google Play<\/a>.<\/li>\n<\/ol>\n<h2>Build and deploy Android App Bundles<\/h2>\n<p>App bundles differ from APKs as they cannot be deployed directly to a device. Rather, it&#8217;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&#8217;s APKs and serve them to your users using Dynamic Delivery.<\/p>\n<p>If you&#8217;re using Visual Studio, you can build your project as a signed app bundle in just a few clicks. If you&#8217;re not using the IDE, you can instead <a href=\"https:\/\/docs.microsoft.com\/en-us\/xamarin\/android\/release-notes\/9\/9.4#initial-support-for-android-app-bundle-publishing-format\">build an app bundle from the command line.<\/a><\/p>\n<p>To enable support for Android App Bundles, you&#8217;ll need to opt-in to the <code>bundle<\/code> value of the <strong>Android Package Format<\/strong> property within your Android options. As you do this, ensure you change your project to a <code>Release<\/code> configuration as app bundles are intended for release packages only. To do this you can follow these steps:<\/p>\n<ol>\n<li>Right click your project, and select <code>Properties<\/code>.<\/li>\n<li>Navigate to <code>Android Options<\/code>.<\/li>\n<li>Change your configuration to <code>Release.<\/code><\/li>\n<li>Change the Android Package Format to <code>bundle<\/code>.<\/li>\n<\/ol>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-46013\" src=\"http:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/12\/PackageFormat.png\" alt=\"Build and deploy Android App Bundles Image 1\" width=\"562\" height=\"52\" srcset=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/12\/PackageFormat.png 562w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/12\/PackageFormat-300x28.png 300w\" sizes=\"(max-width: 562px) 100vw, 562px\" \/><\/p>\n<p>After you&#8217;ve completed these steps, you can generate an app bundle by right clicking your project and selecting <code>Archive<\/code>. This will generate an app bundle for your application.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-46012\" src=\"http:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/12\/Archive.png\" alt=\"Build and deploy Android App Bundles Image 2\" width=\"626\" height=\"94\" srcset=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/12\/Archive.png 626w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/12\/Archive-300x45.png 300w\" sizes=\"(max-width: 626px) 100vw, 626px\" \/><\/p>\n<h2>Test your app bundle<\/h2>\n<p>After you&#8217;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:<\/p>\n<ul>\n<li><a href=\"https:\/\/developer.android.com\/studio\/command-line\/bundletool\">Test your Android App Bundle locally using bundletool<\/a> which generates APKs from your app bundle and deploy them to a connected device.<\/li>\n<li><a href=\"https:\/\/support.google.com\/googleplay\/android-developer\/answer\/9303479\">Share your application with a URL.<\/a> You can share your app as a Google Play Store link with your trusted testers.<\/li>\n<li><a href=\"https:\/\/support.google.com\/googleplay\/android-developer\/answer\/3131213\">Set up a custom delivery.<\/a> You can customize your delivery options based on who you want to test your app.<\/li>\n<\/ul>\n<h2>Learn More<\/h2>\n<p>For more detailed information on Android App Bundles, please see Google&#8217;s\u00a0<a href=\"https:\/\/developer.android.com\/guide\/app-bundle\/\">documentation on Android App Bundles<\/a><a href=\"https:\/\/docs.microsoft.com\/xamarin\/android\/platform\/android-p\">.<\/a><\/p>\n<h2>Summary<\/h2>\n<p>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!<\/p>\n<h2>Feedback<\/h2>\n<p>We encourage your feedback on any issues to be reported via the\u00a0<a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/ide\/how-to-report-a-problem-with-visual-studio-2017\">Report a Problem<\/a>\u00a0option found in your favorite IDE via\u00a0<strong>Help &gt; Report a Problem.<\/strong>\u00a0If you have any questions regarding Android App Bundles, please post them on the\u00a0<a href=\"https:\/\/forums.xamarin.com\/post\/question\/android\">Xamarin Forums<\/a>\u00a0or\u00a0<a href=\"https:\/\/stackoverflow.com\/questions\/ask?tags=xamarin+xamarin.android+android\">Stack Overflow<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Android App Bundle (.aab) is a new upload format that includes all of your app\u2019s compiled code and resources, but defers APK generation and signing to Google Play at install time.<\/p>\n","protected":false},"author":551,"featured_media":46010,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[313,1],"tags":[5,7425,7424],"class_list":["post-46009","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android","category-xamarin","tag-android","tag-android-app-bundle","tag-app-bundles"],"acf":[],"blog_post_summary":"<p>The Android App Bundle (.aab) is a new upload format that includes all of your app\u2019s compiled code and resources, but defers APK generation and signing to Google Play at install time.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts\/46009","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/users\/551"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/comments?post=46009"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts\/46009\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/media\/46010"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/media?parent=46009"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/categories?post=46009"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/tags?post=46009"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}