Windows Subsystem for Android Tryout

Intro

It’s actually a clickbait, as I did not get Windows Subsystem for Android (WSA) working on my Windows 11 instance.

Update (2022-07-04): I upgraded to Windows 11 22H2 via installation media, which let me install WSA despite a few glitches.

Magisk & OpenGApps Integration

Using GitHub Action (Deprecated)

Deprecation Notice: The repo is taken down due to GitHub Action abuse.

  1. Fork MagiskOnWSA
  2. Go to the Actions tab, and select the Build WSA workflow
  3. Run workflow with x64, release-preview/insider slow, stable, none/pico, remove, and magisk chosen
  4. Download the artifact and unzip
  5. Run PowerShell as admin, cd to the folder:
Add-AppPackage .\vclibs.appx
Add-AppPackage .\xaml.appx
PowerShell.exe -ExecutionPolicy Bypass -File .\Install.ps1

During installation, stupid Windows won’t let you install vclibs.appx, either via GUI (App Installer) or via CLI (Windows Terminal).

Both complain that the respective app is running and should be turned off before installation, whereas the app itself is used to install vclibs.appx.

WTF!

Whichever genius in Microshit came up with the awesome idea, fuck you.

Rantings aside, the solution is a bit hacky: just use a different terminal/shell.

For me, I use VSCodium built-in terminal to access PowerShell and it works.

I even thought about writing a Python script and simply import os to get the job done lol.

WSA crashes on first launch and never runs ever since.

It works this time and Google Play & Magisk magically show up.

MagiskOnWSALocal (Deprecated?)

Steps

  1. Get a WSL (in this case, DevuanWSL) and make a backup that you can restore later as WSL VHDX cannot always be shrunk.
  2. Run the following commands:
# Install dependencies the script cannot handle
sudo apt update && sudo apt upgrade -y
sudo apt install bash-completion git unzip vim -y
# Script not working in Devuan
sudo apt install -y aria2 attr e2fsprogs lzip p7zip-full patchelf python3 python3-pip python3-requests python3-venv qemu-utils whiptail

# Clone repo
git clone --depth=1 https://github.com/LSPosed/MagiskOnWSALocal
# Run
cd ./MagiskOnWSALocal
# If the script halts due to `command not found` error, check $PATH
bash ./scripts/run.sh

# Uninstall
rm -rf ./MagiskOnWSALocal
  1. Copy the artifact in output folder
  2. Move to somewhere, extract and run Run.bat (user data of previous MagiskOnWSA installation will be preserved)

Complaints

I gave it a try on Sep 19 using Vultr VPS. For reasons unknown, the SSH connection would terminate even if I’ve used TCPKeepAlive in the config.

The script seems to work fine and the download speed is really fast by the way.

However, the script exits (or the SSH connection halts) after a while when packing the WSA installer… Maybe good luck next time.

I tried another time the next day and everything worked perfectly fine this time. Also, I found out that OpenGApps is restricted to pico for now due to the unmerged PR . Besides that, abusing Actions seems to be the core reason the original repo got disabled , a fork that uses releases instead of actions is still active as of Sep 20,2022.

WSA-Script

As WSA 2306 build has been failing since July 2023, and the PR to fix that is still not merged three months later, I concluded that MagiskOnWSALocal is inactive (if not deprecated) and turn to prebuilt binary from WSA-Script. It’s also possible to have a custom build yourself. I just don’t bother to do it now that it’s built and released automatically by GitHub Actions.

Direct Install

Download the .appx & .msixbundle from store.rg-adguard.net.

Select ProductID and enter 9P3395VX91NR as package id, use the Fast channel.

Sadly this one still does not work for me. So I quit.

App Install

MagiskOnWSA ships w/ Google Play. Just login and download whatever apps you like, if you’re a sucker for Google.

It’s also possible to install via ADB:

  1. Open Windows Subsystem for Android™️ Settings
  2. Go to Developer tab, turn on Developer mode
  3. Wait and see the IP address of WSA
  4. Open preferred shell, run
# Connect
adb connect 127.0.0.1:5555
# Show available devices
adb devices
# If there is more than one emulator...
adb -s 127.0.0.1:5555 <command>
# Install apps
adb -s 127.0.0.1:5555 install <path/to/name.apk>

The adobe procedure is inspired by the guide from Landian News.

File Transfer

adb push MYFILE /sdcard/Download/

Since June 2023 update (2305.40000.4.0), there is finally a Share user folders option disabled by default (*.exe shared by WSA will get blocked):

  • WSA: /sdcard/Windows
  • Windows: %USERPROFILE% (something like C:\USER\stevejobs)

Proxy

Since July 2023 update (2306.40000.4.0), Android apps can connect to devices on the same network, on all versions of Windows 11, respect Windows firewall rules, and work with VPNs. No need for this any more.

It’s possible to use the proxy of Windows host (or if weird enough, literally WSL one).

Set Proxy

# wsaproxy.ps1
$WinNetIP=$(Get-NetIPAddress -InterfaceAlias 'vEthernet (WSL)' -AddressFamily IPV4)
adb connect 127.0.0.1:58526
adb shell settings put global http_proxy "$($WinNetIP.IPAddress):7890"

Unset Proxy

# wsanoproxy.ps1
# https://bbs.pcbeta.com/viewthread-1908825-1-1.html
adb devices
adb shell settings delete global http_proxy
adb shell settings delete global global_http_proxy_host
adb shell settings delete global global_http_proxy_port

One More Thing

It should be possible to use Privoxy following this guide . But I cannot make it work.

Afterwords

One day later (Jun 3,2022), I found out that the removal of Windows Security (offered through Windows Defender) may be the cause for the issue. The registry hack does not solve that so I have to wait for Microsoft to push me an update that automatically installed WD again (or make another fresh install XD).

This remains a mystery. I upgraded to 22H2 w/ WD uninstalled, and WSA works this time.

Try to tweak privoxy or WSL proxy.

In Aug 2022, I gave up tweaking the WiFi / DNS settings via ADB. Instead, I simply reset the network, remove leftover virtual network adapter (VirtualBox), and downloaded NekoBox once for all… After closing the annoying notification, everything works like a charm.

Uninstall QQ from my Android phone instantly once I got it running on WSA. Who the fuck want to use an app w/ an outdated target API?

Done

I should check out WSATools should I get WSA running one day.

I could not find the GitHub repo XD, maybe next time.

Ok, I found it. It’s wslu. It supports quite a few distros now, right inside the official repo!

Vinfall's Geekademy

Sine īrā et studiō