How to play Android games on Linux with Anbox
Android has a lot of video games. Thanks to the Anbox application, it’s possible to play most Android games on Linux.
Using the Anbox runtime on Linux isn’t easy, and requires a lot to get it working correctly. To use it, you need to be using a Linux distribution that supports Snap packages, and has the ability to compile code from source if need be.
Warning! Anbox is beta software, and you may run into issues! Use at your own risk!
Install Anbox
Getting the Anbox system set up on Linux is the easy part of this guide, due to the developer’s decision to distribute the software in a Snap package. To install it, head over to our tutorial about how to use Snaps on Linux. Follow the guide and learn how to set up snapd on your Linux system. When it’s up and running, open up a terminal window and enter the following command to get the latest release of Anbox.
sudo snap install anbox --beta --devmode
Assuming the Snap command above runs without any issues, Anbox should be good to go. However, it’s not usable yet, and that’s because there are multiple components to the software.
The Anbox Snap package is the “front-end” of the software that you’ll be interacting with to install Android apps, but it can’t run without the “backend” software (aka kernel modules) interacting with the core of the Linux kernel. To get the modules, follow the instructions below that correspond with your Linux distribution.
Ubuntu via PPA
To enable the Anbox kernel modules on Ubuntu, you must add a third-party software PPA. To enable it, enter the add-apt-repository command below into the terminal.
sudo add-apt-repository ppa:morphis/anbox-support
With the PPA added to the system, it’s time to run the update command.
sudo apt update
Finally, install the kernel module packages to Ubuntu with the apt install command.
sudo apt install linux-headers-generic anbox-modules-dkms
Arch Linux via AUR
The Arch Linux AUR has the Anbox kernel modules available via the anbox-modules-dkms-git package. To get it working, open up a terminal window and follow the step-by-step instructions below.
Step 1: Install Git and Base-devel on your computer, via Pacman.
sudo pacman -S git base-devel
Step 2: Clone the Anbox kernel modules package to your computer with Git.
git clone https://aur.archlinux.org/anbox-git.git
Step 3: Move the terminal from the home directory (~/) to the “anbox-git” folder with the CD command.
cd anbox-git
Step 4: Run the package build process by executing the makepkg command. If you have issues building the software, be sure to check out the comments on the Anbox AUR page.
makepkg -sri
Other Linux distributions
Aside from Arch Linux and Ubuntu, getting Anbox running is pretty hit and miss, and the developers don’t have a lot of information on the website regarding this. With that said, it’s not impossible. People have gotten Anbox working on a lot of different Linux OSes.
To get the kernel modules running on a Linux operating system that is not Ubuntu or Arch Linux, check this page. It’s the GitHub for the kernel modules. On it, you’ll find detailed instructions on how to compile for Debian, Fedora, etc.
Setting up Linux kernel modules
Once the kernel module packages are installed on your Linux distribution, the hard part is over. All there is to do is to turn on the modules and start using them with the modprobe command.
sudo modprobe ashmem_linux
sudo modprobe binder_linux
Verify the modules are working with:
ls -1 /dev/{ashmem,binder}
You should see:
/dev/ashmem /dev/binder
Install Android tools
Anbox is an Android emulation system, so it requires the Android development tools to install programs on it. Luckily, Android development tools are supported on almost all major Linux distributions, so getting them is not an issue.
To install the Android tools, launch a terminal, search for “android-tools” and install it the way you’d normally install applications on your computer. Alternatively, check out our tutorial on how to get them installed and set up.
Playing Android games on Linux with Anbox
After all of that setup and configuration, Anbox is finally ready to go and we can start using it to play games. To load up and play a game, open up a terminal and follow the steps below to get your game running!
Step 1: Start up the ADB server.
adb start-server
Step 2: Go to https://www.apkmirror.com/ APK Mirror, search for your game and download it. Please note that not all games will work. Also, for the Android game to play correctly with Anbox, the x86 version must be installed.
Step 3: Move the terminal session from the home directory (~/) to the ~/Downloads folder using CD.
cd ~/Downloads
Step 4: Run the ls command and get the filename of the Android APK file to install and copy it. Then, install it with the command below.
adb install name-of-android-video-game-app.apk
Step 5: Open up your application menu, search for “Anbox” and launch the application.
Step 6: Once the Anbox app manager is up and running, use it to launch your Android game.