Anbox
Anbox, which stands for “Android in a box,” is an Android emulator available for GNU/Linux operating systems. However, the term “emulator” might be misleading because Anbox does not use virtualization to run Android. There are many other Android emulators, but Anbox offers the following features:
- Open-source: Anbox is an open-source project, and its source code is available under Apache and GPLv3 licensing.
- Performance: Most popular Android emulators run the Android system in a virtualized environment, which causes reduced performance. Therefore, Anbox, which does not use virtualization, performs significantly better when compared to similar emulators.
- Security: Anbox runs Android apps in tightly contained boxes that cannot directly access your data.
- Integration: Anbox can run on any Linux distribution as long as the kernel comes with the right modules. Furthermore, you can always enable the necessary modules on your own.
Installing Anbox
The Anbox installation consists of two steps. The first step is difficult because it requires working with the kernel modules. However, once the kernel modules are set, Anbox will be ready to go. For our demonstration, we will be using Ubuntu
Configuring kernel modules
Anbox is dependent on two kernel modules: ashmem and binder. For the latest version of any distribution running the latest stable kernel, these modules should already be installed.
To verify if the kernel modules exist, use the following command:
If they do not exist, then they have to be installed manually. To install these kernel modules, your system must have dkms and linux-headers installed. Run the following distribution-specific command to install them.
Debian:
Ubuntu:
For CentOS, RHEL, and derivatives:
For openSUSE, SUSE Linux and derivatives:
Now, let’s install the Anbox kernel modules, which are directly available in the Anbox GitHub module repo.
Run the installation script.
The modules must be manually loaded. Alternatively, you can restart the system to load them by default.
Now, the following command can be used to show if there are two new nodes under the /dev directory.
Install Anbox snap
Anbox is available as a snap package. Therefore, this step will be identical for all distributions. Snaps are universal Linux packages that can be run on any distribution. Check the official snap documentation for the proper snap installation instruction on all supported distributions.
Run the following command to install the Anbox snap.
Because Anbox does not have the full support of snap because it is still in beta, it must be installed using -devmode. Consequently, the snap will not update automatically. To manually update the Anbox snap, run the following command.
Using Anbox
Launching Anbox
Anbox should appear on the app menu. In this example, it is directly accessible from the Ubuntu menu.
This following image shows the base window of Anbox, which lists all the applications that are currently installed.
Now, we will use the Calculator app.
Installing an app on Anbox
To install apps on Anbox, we have to use Android Debug Bridge (ADB). Run the appropriate distribution-specific command to install ADB.
For Debian/Ubuntu and derivatives:
For Fedora and derivatives:
For Arch Linux and derivatives:
For openSUSE, SUSE Linux and derivatives. Check out Android tools at openSUSE:
Once installed, run the following command while Anbox is running to launch the ADB server and recognize Anbox as an Android device connected to the computer.
By default, Anbox does not come with Google Play Store or any other app store installed. We will use ADB to install APK packages on Anbox. Note that apps may not install and run if they contain native binaries that are not compatible with the x86 architecture.
Installing Google Play Store on Anbox
This process, which amounts to running a simple Bash script available on GitHub, is important if you want a full-fledged Android experience. The script will install the Google Play Store along with libhoudini, which is important for running ARM apps.
First, make sure that your system contains all the necessary dependencies to perform this procedure. Run the distribution-specific command.
For Debian/Ubuntu and derivatives:
For Fedora and derivatives:
For Arch Linux and derivatives:
Now, download the script.
Mark the script as an executable file.
Run the script.
Once everything is complete, Anbox is ready to go!
As you can see, the Google Play Store has been installed.
Final thoughts
Anbox is a robust tool for running Android apps on Linux. However, the initial configuration process is complex, and key mapping is lacking. If you can ignore these two flaws, Anbox is a great Android emulator. However, if Anbox is not for you, don’t worry: there are various other Android emulators. Check out the best ways to run Android apps and games on Linux.
Happy computing!