Install Anbox and run Android Apps in Ubuntu

Below article is applicable for those using Ubuntu version 14.04 to 19.04. Those who want to install it for Ubuntu 20.04 LTS release may refer the article here.

Anbox package utilizes a LXC container-based approach to run Android Applications in Ubuntu or any other Linux distribution. With LXC containers, we could run multiple instances of Linux environment on host Linux Kernel. In this article, we would discuss how to install Anbox in Ubuntu. There are two options available to run Android Apps on Ubuntu –

1. Container-based Anbox and,
2. Android-x86 on VirtualBox.

Note: Following operations would require you to have superuser privileges. In case you don’t have one then contact your System Administrator for assistance.

Install Anbox in Ubuntu

We would start by installing Anbox from standard Ubuntu repository –

sudo apt update
sudo apt install anbox

This would install anbox and related dependencies. Next, we would have to download a pre-build Android image (Google search – build anbox io) for Anbox from its official website.

Now, move the downloaded .img file to the folder – /var/lib/anbox/android.img. Note: It is important to rename the file android_amd64.img to android.img.

Next, download and install two kernel modules – Binder and Ashmem. These two kernel-based modules are already available since Debian kernel 4.17. So, skip installation of these modules for Debian. For Ubuntu, the kernel modules can be installed through PPAs (Personal Package Archives) –

sudo add-apt-repository ppa:morphis/anbox-support
sudo apt update
sudo apt install linux-headers-generic anbox-modules-dkms

Once installed, you need to issue the following command to load the respective kernel modules without restarting the OS.

sudo modprobe ashmem_linux
sudo modprobe binder_linux

Cross-check if the modules are properly installed –

ls -1 /dev/{ashmem,binder}

and, start the following services –

sudo systemctl start anbox-container-manager.service
sudo systemctl start anbox-session-manager.service
sudo systemctl start anbox-session-manager.service

Lastly, Anbox could be started from your desktop’s menu.

Install Android apps in Anbox

So far, we have discussed how to install Anbox in Ubuntu. But, merely installing Anbox would not solve the purpose of running Android apps. Therefore, we have to install Android apps in Anbox. This could be achieved with the help of adb command line utility. Hence, we have to install adb (Android Debug Bridge) utility by running the following command in terminal.

sudo apt update
sudo apt install adb

If you have .apk extension file available then, run the following command in terminal to install Android app in Anbox.

adb install path-to/my/app.apk

Once done, you will see the application shortcut in Anbox.

In conclusion, we have discussed how to install Anbox in Ubuntu. Installation of apps through adb command-line utility was also covered in this article.