A look at the Windows Subsystem for Android™️
By Mike Irving - Published: 26/12/2023

For this blog post, I thought I'd look at something a little different:
the little discussed Windows Subsystem for Android™️.

I actually did a brief talk and demo on WSA, as it is in abbreviated form, way back in July at our Dot Net North - MS Build After Party event.

Mike Irving presenting to an audience, at Microsoft Build After Party, Manchester

This is the penned version, with updates and further information.

So, let's take a look at what it is, and what it offers...

 

What is the Windows Subsystem for Android™️ ?

WSA runs an Android Virtual Machine on Windows, using Hyper-V, in a similar way to how the Windows Subsystem for Linux (WSL) works.

Android Apps can then be run on Windows, side by side with other applications.

Whilst it is possible to sideload apps, Apps can also be downloaded from, and indeed published to, the Microsoft Store, via the Amazon Appstore for Android.

Android Apps compiled for x86-64 architecture can be ran natively. Arm64 compiled Android Apps run via Intel Bridge Technology to enable Arm applications on x86 based processors.

Conversely, if you are running Windows 11 on Arm, then Arm apps will run natively.

Of course, any emulation layer provides a performance overhead, so it is recommended that you build Universal Apps, which can target both architectures natively.

 

Opportunities for developers

So what are the opportunities and benefits for developers and software publishers?

Well, the key benefit is reach.

Bring your existing Android applications to Windows, potentially reaching millions new users and devices

It is recommended that you Add support for Keyboard and Mouse to your apps.

 

More information can be found at the following sources:

Microsoft: Windows Subsystem for Android™️
Amazon: Amazon Appstore on Windows
Google: Input compatibility on large screens

 

Amazon Appstore

So let's look at the Amazon Appstore.

Microsoft and Amazon have partnered to bring Amazon's mature Android store front into the Microsoft Store.

The key benefit for consumers is access to thousands of apps and games.

You can port your Google Play apps to Amazon devices, and now Windows devices.

 

The easiest way to install the Windows Subsystem for Android™️, indeed the avenue recommended by Microsoft, is to install the Amazon Appstore from the Microsoft Store

 

Go ahead, open the Microsoft Store, search 'Amazon Appstore' and click Install.

Amazon Appstore in the Windows Store

 

You'll immediately notice this isn't a regular install journey, you will be told that you need to 'Get your PC ready for the Amazon Appstore' (the process of installing WSA). Click 'Download' to get the process started.

Amazon Appstore install - Get your PC ready

 

It may take a little while to download and configure. Progress will be shown on the screen.

Amazon Appstore install - Get your PC ready - progress

 

But before long you should see the 'Done' screen.

Amazon Appstore install - Get your PC ready - Done

 

Go ahead, click 'Open Amazon Appstore'.

Firstly, and briefly, you will see the WSA start screen:
'Starting Windows Subsystem for Android™️'

Windows Subsystem for Android™️ - staring up

 

Windows Firewall might get involved at this point.

I've seen this happen randomly post install too, so be ready to allow prompts such as this:

WSA: Windows Firewall warning

 

The next thing you will see is the Amazon Appstore itself - an Android™️ App running in a window in Windows, woohoo!

Amazon Appstore - please login

 

Login with your Amazon account, and you'll reach the store home screen.

Amazon Appstore home screen

 

Go ahead, search for an Android app, such as the 'BBC Weather' application in this example.

BBC Weather app in the Amazon Appstore

 

Click 'Install' to install it, then 'Open' it.

BBC Weather Android App

 

Yes, this is the BBC Weather app for Android™️, running in a resizable window, in Windows.

You now have two Android Apps open (the Amazon Appstore, and BBC Weather), amongst your native Windows apps.

 

Here: Microsoft Store, Amazon Appstore, BBC Weather, all running together on Windows 11.

Microsoft Store, Amazon Appstore, BBC Weather

 

WSA Settings App

Also installed is a Windows Subsystem for Android™️ 'Settings App'.

To find it, search for it via the Start Menu, and open it.

 

Here you will find various settings, including the option to 'Turn off' the Subsystem.

WSA Settings App

 

If you have turned off the Subsystem, you can also turn it back on via the command line:

WsaClient /launch wsa://system

 

In the 'Apps' section you will find a convenient list of installed Android Apps, including options to Open, Force Stop or load App Settings for each.

WSA Settings App - installed apps

 

There is also an 'Advanced settings' section.

Here you will find the switch to toggle Developer mode on or off.

WSA Settings App - Advanced settings

 

Debugging Android Apps

You can use WSA instead of, or as well as, the Android Emulator, or real devices, for debugging your own applications.


It is easy to setup.

Go back to the Settings App, 'Advanced settings', and turn it on.

 

Click 'Manage developer settings' to configure anything advanced.

WSA Settings App - Developer Mode and Settings

 

The key thing to note here is the IP Address and Port:
'ADB can be connected on 127.0.0.1:58526.' (as shown above).

 

you can now connect to the Subsystem using the adb (Android Debug Bridge) command, in much the same way as you would use adb to connect to a physical Android device, such as a Smartphone or Tablet.

You may need to navigate to the path for the Android Platform Tools first, in my case:
cd "c:\Program Files (x86)\Android\android-sdk\platform-tools\"

then type the following, and should connect up:
adb connect ip:port

On the first attempt, you will get another security warning.
Tick the 'Always allow from this computer' and select 'Allow'

Allow ADB debugging

 

In future it should then happen automatically, such as:

Command Prompt - adb connect

 

WSA should now be available as a debugging device in Visual Studio (or Android Studio, Unity).

 

In Visual Studio, it'll appear in the 'Android Local Devices' list

Visual Studio - Android Local Devices

 

Performance

Performance wise, I have found it much more stable than the Android Emulator, quicker to start and just faster in general.

There are arguments for using both though:

The WSA option is great for quick edit and run cycles, if you are building apps that target tablets or computers, or for testing keyboard and mouse functionality.

If you are building for phones, and need to test advanced features of a device, then you'll want to continue to test with the Android Emulator (or physical devices).

 

.NET MAUI App example

Here is a version of the standard template .NET MAUI App, with the .NET 8.0 target framework. You will see shortly that I have modified the app slightly 🎅

Visual Studio .NET MAUI App template

 

Go ahead and make yourself a .NET MAUI App in Visual Studio,
then run dotnet restore in the Terminal / Developer PowerShell.

.NET MAUI App Code

 

Here, I am running the same app on Windows, the Windows Subsystem for Android™️, and an Android Emulator.

.NET MAUI App on Windows, WSA and Android Emulator


Source code available at:
https://github.com/mikeirvingweb/FestiveTechCalendarMauiApp


This blog was originally penned as part of the Festive Tech Calendar.

My entry was from the 26th of December, 2023 ('Boxing Day' in the UK).

 

🎅 Merry Christmas! 🎄


View Blog Entries...
Page: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11