{"id":2427,"date":"2022-04-28T11:35:49","date_gmt":"2022-04-28T18:35:49","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/surface-duo\/?p=2427"},"modified":"2022-04-28T11:35:49","modified_gmt":"2022-04-28T18:35:49","slug":"windows-subsystem-for-android-wsa","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/surface-duo\/windows-subsystem-for-android-wsa\/","title":{"rendered":"Develop with Windows Subsystem for Android"},"content":{"rendered":"<p>\n  Hello Android developers!\n<\/p>\n<p>\n  We recently had a <a href=\"https:\/\/techcommunity.microsoft.com\/t5\/surface-duo-sdk\/will-be-quot-android-app-on-windows-11-quot-developers-a-part-of\/m-p\/3280761\">query<\/a> via social media about how <em>Windows Subsystem for Android<\/em> (WSA) might be relevant for Microsoft Surface Duo developers. Today\u2019s post explains how to install the Windows Subsystem for Android and some of the ways it can be useful for developers. WSA won\u2019t replace other methods of testing, but it can be a useful addition to physical devices and the <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/android\/emulator\/\">Surface Duo emulator<\/a>.\n<\/p>\n<p>\n  You can read more about Windows Subsystem for Android in the <a href=\"https:\/\/docs.microsoft.com\/windows\/android\/wsa\/\">documentation<\/a>. Note that WSA is currently only available in the United States.\n<\/p>\n<h2>Set up Windows Subsystem for Android<\/h2>\n<p>\n  Follow these instructions to use the Windows Subsystem for Android:\n<\/p>\n<ol>\n<li><a href=\"https:\/\/www.microsoft.com\/en-us\/p\/windows-subsystem-for-android\/9p3395vx91nr\">Install the Windows Subsystem for Android with Amazon Appstore<\/a> from the Microsoft Store.\n<\/li>\n<li>\n  Open the <strong>Windows Subsystem for Android Settings<\/strong> from the Windows <strong>Start<\/strong> menu:\n  <br \/>\n  <img decoding=\"async\" width=\"480\" height=\"132\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/text-description-automatically-generated.png\" class=\"wp-image-2428\" alt=\"Search for Windows Subsystem for Android in the Start menu then open the app\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/text-description-automatically-generated.png 480w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/text-description-automatically-generated-300x83.png 300w\" sizes=\"(max-width: 480px) 100vw, 480px\" \/>\n<\/li>\n<li>\n  Switch <strong>Subsystem resources<\/strong> to <strong>Continuous<\/strong>:\n  <br \/>\n  <img decoding=\"async\" width=\"1913\" height=\"721\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/a-picture-containing-table-description-automatica.png\" class=\"wp-image-2429\" alt=\"The Subsystem resources options are in the System tab of the Settings app. The two options are As needed and Continuous.\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/a-picture-containing-table-description-automatica.png 1913w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/a-picture-containing-table-description-automatica-300x113.png 300w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/a-picture-containing-table-description-automatica-1024x386.png 1024w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/a-picture-containing-table-description-automatica-768x289.png 768w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/a-picture-containing-table-description-automatica-1536x579.png 1536w\" sizes=\"(max-width: 1913px) 100vw, 1913px\" \/><\/p>\n<p>\n  This is optional, and you can always switch back to <strong>As needed<\/strong> if you don\u2019t plan to use the subsystem frequently.\n<\/p>\n<\/li>\n<li>\n  Then in the <strong>Developer<\/strong> tab turn <strong>Developer mode<\/strong> on:\n  <br \/>\n  <img decoding=\"async\" width=\"1282\" height=\"465\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/graphical-user-interface-text-application-email.png\" class=\"wp-image-2430\" alt=\"the Developer tab, where the switch is the first item.\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/graphical-user-interface-text-application-email.png 1282w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/graphical-user-interface-text-application-email-300x109.png 300w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/graphical-user-interface-text-application-email-1024x371.png 1024w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/graphical-user-interface-text-application-email-768x279.png 768w\" sizes=\"(max-width: 1282px) 100vw, 1282px\" \/>\n<\/li>\n<li>\n  There may be no IP address initially. Either open an Android app from the Start menu or just click <strong>Manage developer settings<\/strong> which will start the <em>Android Settings<\/em> app. The screen will update with a local IP address to connect to via ADB:\n  <br \/>\n  <img decoding=\"async\" width=\"1281\" height=\"458\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/graphical-user-interface-text-application-email-1.png\" class=\"wp-image-2431\" alt=\"The IP address shows under the Developer mode switch, and as shown in the screenshot could be 127.0.0.1:58526\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/graphical-user-interface-text-application-email-1.png 1281w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/graphical-user-interface-text-application-email-1-300x107.png 300w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/graphical-user-interface-text-application-email-1-1024x366.png 1024w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/graphical-user-interface-text-application-email-1-768x275.png 768w\" sizes=\"(max-width: 1281px) 100vw, 1281px\" \/>\n<\/li>\n<li>\n  Open a command prompt and use ADB to connect to WSA using the IP and port shown, for example: <\/p>\n<pre>adb connect 127.0.0.1:58526<\/pre>\n<\/li>\n<li>\n  You should now see a new deployment target in Android Studio that you can use to run and debug your Android app on Windows:\n  <br \/>\n  <img decoding=\"async\" width=\"816\" height=\"186\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/graphical-user-interface-text-application-descr.png\" class=\"wp-image-2432\" alt=\"where the debug menu will contain an entry for Microsoft Corporation Subsystem for Android(TM), which will deploy and start the app using WSA\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/graphical-user-interface-text-application-descr.png 816w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/graphical-user-interface-text-application-descr-300x68.png 300w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/graphical-user-interface-text-application-descr-768x175.png 768w\" sizes=\"(max-width: 816px) 100vw, 816px\" \/>\n<\/li>\n<\/ol>\n<h2>Develop with Windows Subsystem for Android<\/h2>\n<p>\n  WSA can be useful for a number of different scenarios when optimizing for dual-screen, foldable, and large screen devices:\n<\/p>\n<ul>\n<li>\n    Testing many different screen sizes and orientations easily, just by dragging the window edge.\n  <\/li>\n<li>\n    Using the <a href=\"https:\/\/developer.android.com\/reference\/androidx\/window\/testing\/layout\/package-summary\">Jetpack Window Manager testing artifact<\/a> APIs to add a virtual fold that you can test your layouts with.\n  <\/li>\n<\/ul>\n<h2>Test windows size classes and \u201ctwo pane\u201d layout controls<\/h2>\n<p>\n  This video shows resizing an Android app window, and watching the layout change according to the size classes defined:\n<\/p>\n<p><video controls style=\"width:600px\"><source src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/04\/example_wsa.webm\" type=\"video\/webm\"><\/video>\n<br \/><em>Figure 1: resizing the window triggers different size classes and layouts (animation)<\/em>\n<\/p>\n<p>\n  Using Windows Subsystem for Android is a convenient way to visualize your app layout in different screen sizes and aspect ratios, and to see how our layout controls adapt to both Surface Duo and other screen sizes, such as the <a href=\"https:\/\/devblogs.microsoft.com\/surface-duo\/jetpack-compose-twopanelayout-preview\/\">Jetpack Compose TwoPaneLayout<\/a>, the <a href=\"https:\/\/docs.microsoft.com\/en-us\/dual-screen\/xamarin\/twopaneview\">Xamarin TwoPaneView<\/a>, and the <a href=\"https:\/\/docs.microsoft.com\/en-us\/dual-screen\/flutter\/twopane-widget\">Flutter TwoPane widget<\/a>.\n<\/p>\n<h2>Works with all developer platforms<\/h2>\n<p>\n  Because Windows Subsystem for Android is configured for testing via ADB, it can be used for testing from any Android developer tooling, including Android Studio, Visual Studio, VS Code, and other integrated development environments. Just remember to connect via ADB to ensure the subsystem is ready to be activated. You can use <code>adb devices<\/code> to check if the Windows Subsystem for Android has been started.\n<\/p>\n<h2>Limitations<\/h2>\n<p>\n  As mentioned above, WSA is only available in the US at this time. It also does not include Google Play Services, so you should continue to use Android emulators and real devices to test your apps. The <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/android\/emulator\/\">Surface Duo emulator<\/a> is available for specifically testing your dual-screen layout adaptations.\n<\/p>\n<h2>Feedback and resources<\/h2>\n<p>\n  If you have any questions, or would like to tell us about your apps, use the\u00a0<a href=\"http:\/\/aka.ms\/SurfaceDuoSDK-Feedback\" target=\"_blank\" rel=\"noopener\">feedback forum<\/a>\u00a0or message us on\u00a0<a href=\"https:\/\/twitter.com\/surfaceduodev\" target=\"_blank\" rel=\"noopener\">Twitter @surfaceduodev<\/a>.\n<\/p>\n<p>\n  Finally, please join us for our\u00a0<a href=\"https:\/\/www.twitch.tv\/surfaceduodev\" target=\"_blank\" rel=\"noopener\">dual-screen developer livestream<\/a>\u00a0at 11am (Pacific time) each Friday \u2013 mark it in your calendar and check out the\u00a0<a href=\"https:\/\/www.youtube.com\/channel\/UClGu9QLtPNz8OdddBfhZXPA\" target=\"_blank\" rel=\"noopener\">archives on YouTube<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello Android developers! We recently had a query via social media about how Windows Subsystem for Android (WSA) might be relevant for Microsoft Surface Duo developers. Today\u2019s post explains how to install the Windows Subsystem for Android and some of the ways it can be useful for developers. WSA won\u2019t replace other methods of testing, [&hellip;]<\/p>\n","protected":false},"author":570,"featured_media":2440,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[365,692,720],"class_list":["post-2427","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-surface-duo-sdk","tag-android-developer","tag-jetpack-compose","tag-windows-subsystem-for-android"],"acf":[],"blog_post_summary":"<p>Hello Android developers! We recently had a query via social media about how Windows Subsystem for Android (WSA) might be relevant for Microsoft Surface Duo developers. Today\u2019s post explains how to install the Windows Subsystem for Android and some of the ways it can be useful for developers. WSA won\u2019t replace other methods of testing, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/posts\/2427","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/users\/570"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/comments?post=2427"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/posts\/2427\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/media\/2440"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/media?parent=2427"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/categories?post=2427"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/tags?post=2427"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}