Develop with Windows Subsystem for Android

Craig Dunn

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’s post explains how to install the Windows Subsystem for Android and some of the ways it can be useful for developers. WSA won’t replace other methods of testing, but it can be a useful addition to physical devices and the Surface Duo emulator.

You can read more about Windows Subsystem for Android in the documentation. Note that WSA is currently only available in the United States.

Set up Windows Subsystem for Android

Follow these instructions to use the Windows Subsystem for Android:

  1. Install the Windows Subsystem for Android with Amazon Appstore from the Microsoft Store.
  2. Open the Windows Subsystem for Android Settings from the Windows Start menu:
    Search for Windows Subsystem for Android in the Start menu then open the app
  3. Switch Subsystem resources to Continuous:
    The Subsystem resources options are in the System tab of the Settings app. The two options are As needed and Continuous.

    This is optional, and you can always switch back to As needed if you don’t plan to use the subsystem frequently.

  4. Then in the Developer tab turn Developer mode on:
    the Developer tab, where the switch is the first item.
  5. There may be no IP address initially. Either open an Android app from the Start menu or just click Manage developer settings which will start the Android Settings app. The screen will update with a local IP address to connect to via ADB:
    The IP address shows under the Developer mode switch, and as shown in the screenshot could be 127.0.0.1:58526
  6. Open a command prompt and use ADB to connect to WSA using the IP and port shown, for example:

    adb connect 127.0.0.1:58526
  7. You should now see a new deployment target in Android Studio that you can use to run and debug your Android app on Windows:
    where the debug menu will contain an entry for Microsoft Corporation Subsystem for Android(TM), which will deploy and start the app using WSA

Develop with Windows Subsystem for Android

WSA can be useful for a number of different scenarios when optimizing for dual-screen, foldable, and large screen devices:

  • Testing many different screen sizes and orientations easily, just by dragging the window edge.
  • Using the Jetpack Window Manager testing artifact APIs to add a virtual fold that you can test your layouts with.

Test windows size classes and “two pane” layout controls

This video shows resizing an Android app window, and watching the layout change according to the size classes defined:


Figure 1: resizing the window triggers different size classes and layouts (animation)

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 Jetpack Compose TwoPaneLayout, the Xamarin TwoPaneView, and the Flutter TwoPane widget.

Works with all developer platforms

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 adb devices to check if the Windows Subsystem for Android has been started.

Limitations

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 Surface Duo emulator is available for specifically testing your dual-screen layout adaptations.

Feedback and resources

If you have any questions, or would like to tell us about your apps, use the feedback forum or message us on Twitter @surfaceduodev.

Finally, please join us for our dual-screen developer livestream at 11am (Pacific time) each Friday – mark it in your calendar and check out the archives on YouTube.

3 comments

Comments are closed. Login to edit/delete your existing comments

  • zeeshan ahmed 0

    Is it possible to change IP Address of Windows Subsystem for Android, can we assign own custom local Lan IP Address.

      • zeeshan ahmed 0

        Want to test application which required local intranet IP Address for connectivity. that’s why want to change IP Address of Windows Subsystem for Android.

Feedback usabilla icon