{"id":45769,"date":"2020-01-15T12:30:51","date_gmt":"2020-01-15T20:30:51","guid":{"rendered":"http:\/\/devblogs.microsoft.com\/xamarin\/?p=45769"},"modified":"2020-01-15T12:13:03","modified_gmt":"2020-01-15T20:13:03","slug":"android-app-bundles-azure-devops","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/xamarin\/android-app-bundles-azure-devops\/","title":{"rendered":"DevOps for Android App Bundles"},"content":{"rendered":"<p>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.\n&nbsp;\n<center><img decoding=\"async\" class=\"aligncenter wp-image-45770\" src=\"http:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/11\/bundles.png\" alt=\"Shrink Android App Size with App Bundles\" width=\"600\" height=\"107\" srcset=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/11\/bundles.png 1255w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/11\/bundles-300x54.png 300w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/11\/bundles-768x137.png 768w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/11\/bundles-1024x183.png 1024w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/center>\n&nbsp;<\/p>\n<h2>Truly Smaller Apps<\/h2>\n<p>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:<\/p>\n<p>&nbsp;\n<center><\/p>\n<blockquote class=\"twitter-tweet\">\n<p dir=\"ltr\" lang=\"en\">\ud83c\udf89 I just published an update for my Android app using Android App Bundles<\/p>\n<p>\ud83e\udd2f As promised, it reduced the app download size from 96.5MB to 29.8MB<a href=\"https:\/\/twitter.com\/hashtag\/XamarinForms?src=hash&amp;ref_src=twsrc%5Etfw\">#XamarinForms<\/a> <a href=\"https:\/\/twitter.com\/hashtag\/XamarinAndroid?src=hash&amp;ref_src=twsrc%5Etfw\">#XamarinAndroid<\/a><a href=\"https:\/\/t.co\/ORCqPJGV0r\">https:\/\/t.co\/ORCqPJGV0r<\/a><\/p>\n<p>\u2014 Brandon Minnick @ Update Prague \ud83c\udde8\ud83c\uddff (@TheCodeTraveler) <a href=\"https:\/\/twitter.com\/TheCodeTraveler\/status\/1184250493037473794?ref_src=twsrc%5Etfw\">October 15, 2019<\/a><\/p><\/blockquote>\n<p><script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><\/center>\n&nbsp;<\/p>\n<p>To learn more about how App Bundle works and how to setup your project, read through the <a href=\"https:\/\/devblogs.microsoft.com\/xamarin\/android-app-bundle\/\" rel=\"noopener noreferrer\" target=\"_blank\">previous post on App Bundle support<\/a> 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.<\/p>\n<p>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.<\/p>\n<h2>App Center<\/h2>\n<p>In September, App Center released official support that automatically detects your project settings. However, if you don&#8217;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!\n&nbsp;\n<center><img decoding=\"async\" class=\"aligncenter wp-image-45771\" src=\"http:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/11\/AppCenter.png\" alt=\"Build App Bundle in App Center\" width=\"598\" height=\"400\" srcset=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/11\/AppCenter.png 790w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/11\/AppCenter-300x201.png 300w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/11\/AppCenter-768x513.png 768w\" sizes=\"(max-width: 598px) 100vw, 598px\" \/><\/center>\n&nbsp;\nWhen the build has finished, easily download your files or submit them directly to Google Play for distribution.\n<center><img decoding=\"async\" class=\"aligncenter wp-image-45772\" src=\"http:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/11\/word-image-4.png\" alt=\"Download App Bundle App Center\" width=\"540\" height=\"400\" srcset=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/11\/word-image-4.png 661w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/11\/word-image-4-300x222.png 300w\" sizes=\"(max-width: 540px) 100vw, 540px\" \/><\/center>\n&nbsp;\nLearn more about how App Bundle support in App Center on <a href=\"https:\/\/devblogs.microsoft.com\/appcenter\/using-the-android-app-bundle-with-visual-studio-app-center\/?WT.mc_id=docs-xamarinblog-jamont\">their blog<\/a>.\n&nbsp;<\/p>\n<h2>Azure DevOps<\/h2>\n<p>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. <\/p>\n<p>The first step is to ensure you have your <strong>Keystore<\/strong> available to sign your App Bundle. This can be done by <a href=\"https:\/\/docs.microsoft.com\/azure\/devops\/pipelines\/tasks\/utility\/download-secure-file?WT.mc_id=docs-xamarinblog-jamont\">Downloading Secure File task<\/a> 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.\n&nbsp;\n<center><img decoding=\"async\" class=\"aligncenter wp-image-45774\" src=\"http:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/11\/KeyStore.png\" alt=\"Azure DevOps download keystore\" width=\"443\" height=\"400\" srcset=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/11\/KeyStore.png 663w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/11\/KeyStore-300x271.png 300w\" sizes=\"(max-width: 443px) 100vw, 443px\" \/><\/center>\n&nbsp;\nIf you are already building your app in Azure DevOps, simply clone your existing &#8220;Build Android App&#8221; 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 <b>Create app package<\/b> option. The main difference being that you will want to pass in <b>Additional arguments<\/b> for the build to package and sign the App Bundle:<\/p>\n<pre><code>\r\n-restore -t:SignAndroidPackage -p:AndroidPackageFormat=aab -p:AndroidKeyStore=True -p:AndroidSigningKeyStore=$(keystore.secureFilePath) -p:AndroidSigningStorePass=$(KeystorePassword) -p:AndroidSigningKeyAlias=$(KeystoreAlias) -p:AndroidSigningKeyPass=$(KeystorePassword)\r\n<\/code><\/pre>\n<p>Here are the specified Keystore passwords and alias in the <b>Variables<\/b> 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!\n&nbsp;\n<center><img decoding=\"async\" class=\"aligncenter wp-image-45775\" src=\"http:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/11\/Packages.png\" alt=\"Packages from Azure DevOps\" width=\"800\" height=\"382\" srcset=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/11\/Packages.png 1178w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/11\/Packages-300x143.png 300w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/11\/Packages-768x366.png 768w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2019\/11\/Packages-1024x489.png 1024w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/center>\n&nbsp;<\/p>\n<h2>Optimize and Shrink Your App<\/h2>\n<p>For a full breakdown of what App Bundles are and how they work, checkout the full <a href=\"https:\/\/channel9.msdn.com\/Shows\/XamarinShow\/Android-App-Bundles-101--The-Xamarin-Show?WT.mc_id=docs-xamarinblog-jamont\" target=\"_blank\" rel=\"noopener noreferrer\">Xamarin Show with Jon Douglas<\/a>.\n&nbsp;\n<center><iframe width=\"560\" height=\"315\" src=\"https:\/\/channel9.msdn.com\/Shows\/XamarinShow\/Android-App-Bundles-101--The-Xamarin-Show\/player\" allowfullscreen=\"allowfullscreen\" frameborder=\"0\" title=\"Android App Bundles 101 | The Xamarin Show - Microsoft Channel 9 Video\"><\/iframe><\/center>\n&nbsp;\nFor deeper dive topics, be sure to read the previous blog on <a href=\"https:\/\/devblogs.microsoft.com\/xamarin\/shrinking-android-app-size\/\" target=\"_blank\" rel=\"noopener noreferrer\">Shrinking your Android App Size<\/a>. Additionally, follow along with all our <a href=\"https:\/\/docs.microsoft.com\/xamarin\/android\/deploy-test\/release-prep\/?WT.mc_id=docs-xamarinblog-jamont\">documentation on preparing your Android app for release<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Android App Bundle is a new app packaging format from Google for Android applications that dramatically reduces the install size for end users.<\/p>\n","protected":false},"author":544,"featured_media":45776,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[313,2,291],"tags":[5,7425,7424,6715,7423,648],"class_list":["post-45769","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android","category-developers","category-xamarin-platform","tag-android","tag-android-app-bundle","tag-app-bundles","tag-app-size","tag-optimizations","tag-performance"],"acf":[],"blog_post_summary":"<p>Android App Bundle is a new app packaging format from Google for Android applications that dramatically reduces the install size for end users.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts\/45769","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\/544"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/comments?post=45769"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts\/45769\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/media\/45776"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/media?parent=45769"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/categories?post=45769"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/tags?post=45769"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}