Skip to main content

[Guide] Playing Android games on Linux PC with Android-x86 VM + QtScrcpy

Linux Virtual Machine and Container Android-X86 QEMU
Table of Contents

🇹🇼 中文版

This guide is about installing Android-x86 9.0 QEMU virtual machine on x86_64 Linux host, so you can play Android games with 3D acceleration, keymappings on Linux PC. Google Play is also included.

Tested on Gentoo Linux (gentoo-kernel-bin 5.19.16) and Arch Linux (linux-zen-6.0.3) .

1. Prerequisites
#

  • A x86_64 Linux PC
  • 4-cores CPU
  • Intel or AMD GPU. Nvidia proprietary driver does not support VirGL (virtual OpenGL renderer).
  • 8GB+ RAM
  • 64GB+ storage

2. Install required packages
#

Install QEMU, Libvirt, Virt Manager on your Linux host.

Enable libvirtd services:

sudo systemctl enable --now libvirtd

Make sure KVM modules are loaded:

lsmod | grep kvm

3. Install Android-x86 VM
#

Note: You can try advanced Bliss OS instead of vanilla Android-x86. The installation procedure is similar to each other.

  1. Download Android-x86 ISO from official website. Choose Android 9.0-r2 64bit.

  2. Launch Virt Manager. Clcik Creat a new VM.

  3. Select Manual Install

  4. Select Androd-x86 9.0

  5. Allocate 8GB RAM (minimum 4GB) and 4 cores.

  6. Create a 64GB hard drive

  7. Check Customize configuration before install

  8. Click Overview. Select Q35 for Chipset and UEFI x64 OVMF_CODE for Firmware. Apply.

  9. Click IDE Disk, switch Disk bus to VirtIO. Apply.

  10. Click NIC, switch Device model to virtio. Apply.

  11. Click Display Spice. Swtich Listen Type to None. Check OpenGL and select Intel GPU. Apply.

  12. Click Video QXL, switch to Virtio. Check 3D acceleration. Apply.

  13. Click Add Hardware, click Storage, switch Device Type to CDROM. Switch Bus Type to SATA. Click Manage and select Android-x86 ISO. Finish.

  14. Click Boot options. Change boot order to SATA CDROM.

  15. Click Begin Installation. Use keyboard arrows to move selection. First move to Installation, enter.

  16. Select Create/Modify partitions

  17. Use GPT

  18. Move selection to [New], enter.

  19. Enter. Next type +512M

  20. Type ef00 then name the parition EFI

  21. Next, move selection to the third one. Select [New], enter for 3 times.

  22. Name the partition Android.

  23. Move the selection to [Write], type yes. Then move to [Quit].

  24. Select vda2

  25. Format vda2 to EXT4

  26. Install EFI GRUB

  27. Format the EFI partition

  28. Select Yes. Make /system mounted as Read & Write.

  29. Boot into Android-x86.

  30. Conect to VirtWifi. Setup the Android-x86 device.

  31. Launch Terminal Emualtor in Android-x86 VM. Type su, grant root permission:

  32. Type dmesg | grep virgl to check if VirGL is loaded.

  33. Click bulb icon, remove CDROM from Hardware list.

4. Install libhoudini for Android-x86
#

It’s recommened to install x86 APK for stability, Google Play would filter x86 apps for you. However many games only support ARM architecture. In order to run ARM apps on a x86 machine, we need a ARM translator/Native bridge.

Houdini is an ARM translator developed by Intel. Currently it only supports running ARMv7 (32bit) Android APPs on Android-x86 9.0.

  1. Launch System settngs → Android-x86 options, select Enable native bridge.

  2. It should start downloaing libhoudini. However it will failed to download. So we need to manually install libhoudini.

  3. Launch Chrome in Android-x86 VM. Download libhoudini from Android-x86 official website

  4. Launch Terminal Emulator, execute following commands:

su
mkdir /data/arm
cp /sdcard/Download/houdini.sfs /data/arm/houdini9_y.sfs
enable_nativebridge
  1. Reboot the VM. Now you should be able to download ARM apps from Google Play, such as Smash Hit.

P.S. Sometimes you still need to toggle Enable native bridge again in System settings after reboot.

5. Tips for Android-x86 VM
#

5.1. QtScrcpy games keymapping
#

Want to play FPS games in Android-x86 VM?

Games do not response to mouse clicks but only touching events in Android-x86 VM?

QtScrcpy could solve these problems!

  1. Download QtScrcpy for Linux. Unzipped the archive. Run qtscrcpy:
./qtscrcpy
  1. Check IP address of Android-x86 VM from Virt Manager → NIC

  2. In QtScrcpy, fill in the Wireless with Android-x86’s IP. Click wireless connect.

  3. Double click phone device at left panel

  4. A new window will popup (yeah there are two windows right now). You can emulate touch events in QtScrcpy window.

  5. Create a directory named keymaps at QtScrcpy’s directory.

cd </path/to/qtscrcpy>
mkdir keymap
cd keymap
  1. Download example keymapping scripts from Github.
wget https://raw.githubusercontent.com/barry-ran/QtScrcpy/dev/keymap/test.json
  1. Click refresh script in QtScrcpy. Click apply.

  2. Press ~ key in Android-x86 VM to toggle the script. This script will trigger scrolling events when pressing Up arrow key in Android-x86 VM.

  3. Now try to write yout own scripts. See guidelines here. Below is an exmaple for World War Heroes — WW2 PvP FPS:

{
	"switchKey": "Key_QuoteLeft",
	"keyMapNodes": [
		{
			"comment": "Moving",
			"type": "KMT_STEER_WHEEL",
			"centerPos": {
				"x": 0.16,
				"y": 0.75
			},
			"leftOffset": 0.1,
			"rightOffset": 0.1,
			"upOffset": 0.27,
			"downOffset": 0.2,
			"leftKey": "Key_A",
			"rightKey": "Key_D",
			"upKey": "Key_W",
			"downKey": "Key_S"
		},
		{
			"comment": "Moving camera",
			"type": "KMT_STEER_WHEEL",
			"centerPos": {
				"x": 0.8,
				"y": 0.7
			},
			"leftOffset": 0.1,
			"rightOffset": 0.1,
			"upOffset": 0.27,
			"downOffset": 0.2,
			"leftKey": "Key_Left",
			"rightKey": "Key_Right",
			"upKey": "Key_Up",
			"downKey": "Key_Down"
		}
	]
}

5.2. Running multiple Android-x86 VMs
#

Shutdown the VM. Right click the Android-x86. Select Clone VM.

5.3. Booting Android-x86 VM with QEMU commandlines
#

See Install BlissOS in QEMU.

Wrapping up
#

Android-x86 9.0 currently does not support ARM64 only apps, so it is impossible to run some games in Android-x86 VM.

References
#

Related

Convert images to AVIF/AVIFS with open-source tools
Linux Linux Good Software AOMedia Video 1
Run Windows exe on Android through Proot Exagear on Termux
Smartphone Termux Tutorial Termux Windows Android
Analyzing the Elements in Children’s Books: The Wind in the Willows
Liberal Arts Personal Thoughts

Leave a comment

Choose the comment system you like. Giscus for codes, Disqus for anonymous comments.

Please login to your Github account to leave a comment. You can post codes here for discussion. For images, please upload to Imgur and copy links. Your comments would be visible to everyone on Github Discussions.

This comment system is provided by Disqus, you may see forcing Disqus ADs on this page. Sometimes your comment may need to be reviewed, resulting in delayed display. Thank you for your understanding.