The Windows Subsystem for Android (WSA) integrates native Android apps into the Windows 11 desktop. This post will teach you how to set up and configure the Windows Subsystem for Android for use in software development. It will be much easier for developers to replicate this with the use of Windows tools for developers.
Read on to see what is required to run WSA as well as what is required to target it from your Android development. Windows Subsystem for Android is available for public preview on Windows 11. I was joined by a special surprise guest: Scott Hanselman.
Watch the full replay on YouTube
Table of Contents
Android on Windows?
- Windows Subsystem for Android (WSA) runs Android apps on Windows 11
- Runs Android 11 behind the scenes
- Similar to Windows Subsystem for Linux (WSL)
- Comes with Amazon Appstore (US Only for now)
- An Amazon account is required to use the Amazon Appstore
- Allows for developer mode support and sideloading
- Android apps are on your start menu
- Only in Windows 11
- WSA utilizes a virtual machine (VM)
Hardware Requirements
- Requires an SSD
- I wasn’t able to run it in a VM
- On Windows x64 (Intel or AMD) it uses an interoperability layer
- On Windows ARM64 it runs natively
- Windows 11 enforces a minimum screen requirement of 720p resolution (1280×720) with a >9” screen.
System Requirements Documentation
WSA support.microsoft.com/windows/f8d0abb5-44ad-47d8-b9fb-ad6b1459ff6c
Windows 11 support.microsoft.com/windows/86c11283-ea52-4782-9efd-7674389a7ba3
WSA Installation
- Windows Subsystem for Android is available for public preview on Windows 11.
- Install the Amazon Appstore from the Microsoft Store.
- Alternatively just install an Android app from the Microsoft Store.
- docs.microsoft.com/en-us/windows/android/wsa/ & support.microsoft.com/windows/f8d0abb5-44ad-47d8-b9fb-ad6b1459ff6c
WSA VM Lifecycle
- There are three possible states for the VM running apps with Windows Subsystem for Android:
- Running
- Lightweight Doze: After no app activity for 3 minutes. Deactivated by user activity or an app notification.
- Not Running: After activity for 7 minutes.
- Transitions between these states are triggered by user activity, Android app or an app notification.
- Android apps are paused and then stopped when their window is minimized.
- Docs docs.microsoft.com/en-us/windows/android/wsa/
Performance
- The data on this chart is gathered from user-submitted Geekbench 5 CPU results from the Geekbench Browser: browser.geekbench.com
- Sources:
Passmark Performance Test
- Sources: PassMark PerformanceTest Mobile
Hardware Report
Notes: From Geekbench 5
Resolution is based on Android app window size
320 PPI when running at 200% scale
160 PPI when running at 100% scale
Settings & Developer Mode
- Launch Windows Subsystem for Android
- Scroll down & enable Developer mode
- Copy the IP address
- Use ADB to connect -> adb connect 172.24.203.234
- Optional:
- Connect from other local computers via your IP address and port specified
- Manage Android Settings via link
- Note:
- Subsystem can run “As needed” or “Continuous”
- Files let you browse but not transfer files
Digging into Details
Who is Houdini?
- ARM to x86 native bridge by Intel.
- Not a lot of official public information.
- Also used in Intel Chromebooks, and desktop emulators like BlueStacks & NOX.
- Reads ARM opcodes and produces corresponding behavior in x86.
- binfmt_misc (Miscellaneous Binary Format) Linux kernel feature passes ARM to Houdini.
- Related files on WSA
- /system/lib64/libhoudini.so
- /system/lib/libhoudini.so
- /vendor/lib/libhoudini.so
- /vendor/lib64/libhoudini.so
- /proc/sys/fs/binfmt_misc
- /vendor/etc/binfmt_misc/arm64_dyn
- /vendor/etc/binfmt_misc/arm64_exe
- /vendor/etc/binfmt_misc/arm_dyn
- /vendor/etc/binfmt_misc/arm_exe
Sideloading
- Connect: adb connect <ip>
- Check connection: adb devices
- Install: adb install -r –no-streaming <apk file>
- Uninstall: adb shell pm uninstall -k com.embarcadero.ProjectName
- Run app: adb shell am start -n com.embarcadero.ProjectName/com.embarcadero.firemonkey.FMXNativeActivity
- Kill/Stop app: adb shell am force-stop com.embarcadero.ProjectName
- Open shell: adb -d shell
- Push file: adb push <local file name> /storage/emulated/0/Download
- Pull file: adb pull /storage/emulated/0/Download <local file name>
Targeting from Delphi & RAD Studio IDE
- A single FMX project can target Windows or Android already.
- WSA is in Preview and not yet fully support by Delphi, but that won’t stop us….
- Connect with ADB and then it shows up in the IDE.
- FireMonkey apps either don’t run or report error “Your Android device does not support selected platform architecture.”
- Sideloading!
- Compile for Android 64
- adb install -r –no-streaming FireMonkeyApp.apk
- Also make resizable
Making Your Android App Resizable
- Edit AndroidManifest.Template.xml
<application android:resizeableActivity=“true”>
- Note that if you have multiple Android apps in the same folder they share the same AndroidManifest.Template.xml
- Allows FMX Android app to resize as expected.
Automating the Manual
- Add manualadb.bat to IDE Tools menu
- Tools -> Configure Tools -> Add
- With parameters: $PATH($EXENAME) $NAMEONLY($PROJECT)
- Source: gist.github.com/jimmckeeth/3a453ccdb1a387644ca137b499d01879
Mobile Snippets Tests
- Location must be enabled in Windows to work in WSA
- Notification appear on desktop and can wake WSA
Get the steps on how to turn on Developer Mode on Chromebook to reduce development time and improve your levels of efficiency.
More information
- Webinar Slides, Links, Replay: blogs.embarcadero.com/?p=134192
- ADB Deployment GIST: gist.github.com/jimmckeeth/3a453ccdb1a387644ca137b499d01879
- Introduction blog: blogs.windows.com/windows-insider/2021/10/20/introducing-android-apps-on-windows-11-to-windows-insiders/
- Windows Subsystem for Android docs: docs.microsoft.com/en-us/windows/android/wsa/
- WSA Release Notes: docs.microsoft.com/en-us/windows/android/wsa/release-notes
- WSA Hardware Requirements: support.microsoft.com/windows/f8d0abb5-44ad-47d8-b9fb-ad6b1459ff6c
- Mobile apps on Windows: support.microsoft.com/windows/abed2335-81bf-490a-92e5-fe01b66e5c48
- Video from Scott on WSA: https://youtu.be/FN6zON_zKd8
- Scott Hanselman online: www.hanselman.com, www.hanselminutes.com and @shanselman
- Slight of ARM: Demystifying Intel Houdini by Brian Hong from DefCon 29
- Video: https://youtu.be/9oQ5XjA1aq0 Slides: https://bit.ly/3IzoMkM
Next Steps
- Start a RAD Studio trial embarcadero.com/products/rad-studio/start-for-free
- Get Community Edition embarcadero.com/products/delphi/starter
- See special offers embarcadero.com/radoffer
- Subscribe on YouTube youtube.com/c/EmbarcaderoTechnologies
- Follow us on Twitter twitter.com/embarcaderotech
- Like us on Facebook facebook.com/embarcaderotech
- Follow us on LinkedIn linkedin.com/company/embarcadero-technologies
- Read our blog blogs.embarcadero.com