Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
DelphiNewsWebinar

Android on Windows 11: A Developer’s Perspective

windows subsystem for android 3

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

https://youtu.be/ub6WVP26_Cg
<object class=”wp-block-file__embed” data=”https://blogs.embarcadero.com/wp-content/uploads/2022/03/Android-on-Windows-11-A-Developers-Perspective-Windows-Subsystem-For-Android-with-Jim-and-Scott-9396411.pdf” type=”application/pdf” style=”width:100%;height:600px” aria-label=”Embed of <strong>Slides: Slides: Android on Windows 11 – A Developer’s Perspective (Windows Subsystem For Android)Download

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.
android01 6176918

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

android02 7199513

WSA VM Lifecycle

android03 4969074
  • 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

Passmark Performance Test

Hardware Report

android06 8432563

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

android07 6743286
  • 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

android08 8895456

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

android09 8753876
  • 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

android10 4036795
  • 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

android11 2170348

Mobile Snippets Tests

android13 1010219
android12 7163568
  • 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

Next Steps


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

Director of Delphi Consulting for GDK Software USA. Many software related patents, including swipe and pattern unlock and search engines. First Silver and Gold Delphi badges on Stack Overflow Former Developer Advocate for Embarcadero Technologies. Long time fan of programming, especially with Delphi. Author, Podcaster/YouTuber, Improvisor, Public Speaker, Father, and Friend.

2 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES