Skip to content
Mahmudul Hasan

Run and Debug MAUI/Xamarin as a Native Windows 11 App Using WSA

Xamarin, MAUI, WSA, Windows 11, Windows Sub System for Android2 min read

Run MAUI or Xamarin in WSA banner

Did you know that you can run and debug your MAUI or Xamarin APK as a native Windows 11 app? Well, in Windows 11, Microsoft has introduced a new Windows Sub System for Android called WSA. WSA allows you to run APKs as native Windows 11 apps. This article explains how to run an APK as a native Windows 11 app using WSA.

First thing first, make sure you have the latest version of the Microsoft Store. Now you need to install the Amazon Appstore from the Microsoft Store. The WSA will be installed during this installation process.

Set up your development environment

Search for Windows Sub System for Android Setting in the start menu and open it. From the setting window, you can access the android file manager app. Open the file manager and it will boot up the android system.

Note: The WSA gets killed after a few times of inactivity. If you want it to be run all the time, select Continuous from the Subsystem Resources dropdown.

Now, Turn on the Developer Mode from the setting menu. A new IP address will be generated. Don't get surprised if it looks like 127.0.0.1:58526 😉😜.

Now click on Manage Developer Settings and the native android developer settings app will open. You can modify the settings to your liking. But make sure the USB Debugging is enabled.

WSA Setting page

Now, follow the following steps.

  • Open the Visual Studio. (I've tested on 2022 but it should work with other versions too.)
  • Click on Tools and then Android.
  • Select ADB Command Prompt from the child menu. A new cmd window will open.
  • Type adb connect [IP address] in the command prompt and hit enter.
  • Now you should be able to see the WSA in the android device list as the following image.
Android Device List with WSA

See it in action

Now, if we run the app, will see our app running with Windows 11's native UI Frame.

Android App Running in WSA

Caution

Sometimes you may see the adb connection error. Most of the time, this is because you've entered the wrong IP. Make sure that it is correct. You'll get the correct IP address from the WSA setting app under the developer option.

If you can't see the WSA in your device list, make sure the adb is connected to that IP. Because sometimes it gets disconnected due to inactivity.

Conclusion

You can not only debug your android application using WSA but also download the android applications, games from Amazon App Store and run them on your Windows 11 device. Also, not only with Visual Studio, you can use WSA as your development environment with other tools like Android Studio, Visual Studio Code, IntelliJ IDEA, etc.

© 2022 by Mahmudul Hasan. All rights reserved.