Launch Android apps on Linux with Anbox
Piggyback
Have you ever wished you could use an Android smartphone app on your Linux desktop? Thanks to Anbox and Snap, you can launch Android apps in a Linux virtual environment.
Linux already supports Java applications on the desktop, as well as native programs. You can rehash some legacy Windows software with Wine or Crossover. With the help of the DOSbox in Linux, you can even breathe life into very old applications for the 16-bit DOS operating system.
Anbox [1] pursues a similar approach. You can integrate a full-fledged Android operating system under Linux with a few simple steps and work with the included apps even more comfortably than on your Android smartphone.
The free Anbox software is only available as source code and as a Snap archive [2]. This means that the application only runs on Linux distributions that support Snap's virtual container technology, which includes all Ubuntu and Debian derivatives.
Anbox contains a complete Android system in a Snap container. The container is completely isolated from the host system thanks to Linux containers (LXC) [3]. Android thus does not have direct access to the Linux host's hardware. Instead, this access is managed by the Anbox daemon on the host, which makes it difficult to transfer malware to the Linux host.
To use Anbox, you first need to set up the Snap daemon. You can do this easily on Ubuntu, Linux Mint, or Debian by using Synaptic to install the snapd package from the repositories. Next, you need to integrate two further kernel modules (Listing 1, lines 1 to 3).
Listing 1
Installing Anbox
Rebooting loads the modules. You will now find two new entries, ashmem
and binder
, in the /dev/
directory. Next, use Snap to install Anbox with the command from line 4 of Listing 1. The installation process takes a little longer even on state-of-art hardware, and numerous status messages are output on screen.
When the installation is complete, you will find the Anbox Application Manager and Android Settings entries in your desktop's menu hierarchy. Click on the Anbox Application Manager to start the Android environment on Linux (Figure 1).
The software initially only displays preinstalled applications. You now need to prepare the Android container for integrating more applications by setting up the Android Debug Bridge (Listing 1, line 5).
Software
Because Google does not certify the Anbox project and there is no agreement to use Google Play, Google is not preinstalled with Anbox. Consequently, Google can't collect your personal data via the Play Store. Instead, the Debug Bridge lets you add packages in Android's own APK format to the Anbox container.
First search for an APK mirror on the Internet that provides the packages. You will usually find current and older versions of several thousand Android apps. After downloading the desired apps, type the following in the terminal window without root privileges:
adb install <APK package>
This installs the app. Note that Anbox must be running when the installation command is called; otherwise, the installation aborts with a device error.
Although most of the programs offered on the mirror servers are designed for the ARM hardware used in smartphones and tablet PCs, this does not matter for the installation on Anbox. Problems only arise if apps require special WLAN or GPS hardware. If this is the case, an error message will appear in the Linux terminal.
Once you manage to install the APK package, the terminal displays a Success message. You simultaneously will find a starter icon for the software in the Anbox Application Manager that lets you open the app with a mouse click.
In contrast to a smartphone, several applications can be launched simultaneously as each runs in its own window. This lets you use multiple Android apps along with other programs on the desktop. Since you can resize the windows, an app's contents can be viewed much more clearly than on the comparatively small smartphone displays (Figure 2).
![](/var/linux_magazin/storage/images/issues/2019/229/launch-android-apps-on-linux-with-anbox/figure-2/758090-1-eng-US/Figure-2_large.png)
Troubleshooting
Occasionally, an Android app tries to access special hardware that is missing on the system. This kind of direct access typically crashes the program in question, taking Anbox down at the same time.
Fortunately, each Anbox window on the Linux system runs in a separate process with its own process ID (PID). To fix the problem, use ps ax
to find the faulty process in the terminal and terminate it with
kill 9 <PID>
To remove the app from the Anbox Application Manager, enter the command
adb remove <APK packet>
in the terminal. The routine now removes the files and the starter icon from the Anbox window.
Settings
You can access Anbox's Settings dialog by clicking on the Settings icon in the Application Manager or via Android Settings in the desktop menu hierarchy. You will find numerous setting options not only for the physical target system, but also for the replicated smartphone.
The size settings for fonts and messages in the Anbox windows are especially useful. Making the appropriate adjustments means that the contents are easier to read in small windows (Figure 3). However, in our lab with several Linux distributions, some control elements did not react at all, while others crashed the window.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
![Learn More](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.
-
SUSE Offers CentOS 7 Support with Liberty Linux Lite
SUSE's Liberty Linux support offering now includes CentOS 7, which means businesses won't be forced to migrate those servers for some time.
-
Ubuntu's App Center Finally Supports Local Installs Again
If you regularly download .deb files and would prefer a GUI method of installing, Ubuntu has your back.
-
AlmaLinux Now Supports Raspberry Pi 5
If you're looking to create with the Raspberry Pi 5 and want to use AlmaLinux as your OS, you're in luck because it's now possible.
-
Kubuntu Focus Releases New Iterations of Ir14 and Ir16 Laptops
If you're a fan of the Kubuntu Focus laptops or have been waiting for the right time to purchase one, that time might be now.
-
NixOS 24.05 Is Ready for Prime Time
The latest release of NixOS (Uakari) has arrived and offers its usual reproducible, declarative, and reliable goodness.
-
Linux Lite 7.0 Officially Released
Based on Ubuntu 24.04 and kernel 6.8, Linux Lite version 7 now offers more options than ever.
-
KaOS Linux 2024.05 Adds Bcachfs Support and More
With updates all around, KaOS Linux now includes support for the bcachefs file system.
-
TUXEDO Computers Unveils New Iteration of the Stellaris Laptop Line
The Stellaris Slim 15 is the 6th generation and includes either an AMD or Intel CPU