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:
- Install the Windows Subsystem for Android with Amazon Appstore from the Microsoft Store.
-
Open the Windows Subsystem for Android Settings from the Windows Start menu:
-
Switch Subsystem resources to Continuous:
This is optional, and you can always switch back to As needed if you don’t plan to use the subsystem frequently.
-
Then in the Developer tab turn Developer mode on:
-
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:
-
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
-
You should now see a new deployment target in Android Studio that you can use to run and debug your Android app on Windows:
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.
Is it possible to change IP Address of Windows Subsystem for Android, can we assign own custom local Lan IP Address.
I don’t see any mention of the IP Address being configurable in the docs:
https://docs.microsoft.com/windows/android/wsa/
What’s the use-case that this would help with?
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.