How to use Anbox to run Android applications on Linux

To
You can download this article in PDF format via the link below to support us.

Download the guide in PDF format

turn off
To

To
To

A one-stop shop that provides most of the products you need can save you a lot of exercise, time, and bring you a sense of convenience. You know the story. You can pick and buy most (if not all) of the goods that take you to the store. It may be far-fetched, but the examples given can be applied to your Linux operating system. how about it? You may ask. So, how to put all Android apps and favorite desktop apps on the same lace? At least for me, this may be amazing.

An open source tool called Anbox can make this possibility a reality. Anbox puts the Android operating system into a container, abstracts hardware access, and integrates core system services into the GNU/Linux system. Every Android application integrates with your operating system like any other native application.

Anbox uses standard Linux technologies such as containers (LXC) to separate the Android operating system from the host. Any Android version is suitable for this method, and it will try to keep up with the latest available version of the Android Open Source Project. Resources: Anbox website

Features of Anbox

  • Open source: The entire source code has been obtained and licensed under the terms of the Apache and GPLv3 licenses.
  • No limit: Since Anbox runs the entire Android system, conceptually any application can be run.
  • Security: Anbox can put Android applications in a closed box without direct access to hardware or data.
  • Performance: Run Android without hardware virtualization, and seamlessly bridge hardware acceleration functions.
  • Integration: Tightly integrate with the host operating system to provide a rich feature set.
  • Fusion: Anbox can be scaled across various form factors like Android. It can be used on laptops and mobile phones.

Install Anbox

To install Anbox, your system needs to support snapshots. To quickly grasp snapshots, please visit snapcraft.io to learn about the meaning of snapshots, how to install and support snapshots in the release, and how to use snapshots.

In order to install Anbox on your system, we will follow two steps, namely:

  • Install the necessary kernel modules (ashmem and binder)
  • Install Anbox buckle

In this example, we will install Anbox on Ubuntu 20.04 (Focal Fossa) desktop version.

Step 1: Update and install basic tools

After entering the terminal of the new Ubuntu desktop, update it and install the basic tools that will be used during the installation process

sudo apt update && sudo apt upgrade
sudo apt install android-tools-adb git curl unzip -y

Step 2: Install ashmem and binder kernel modules

We need to install dkms and linux-header on the system, and then we will proceed to clone the modules from Git and install them. please continue.

sudo apt install dkms
sudo apt install linux-headers-generic
cd ~
git clone https://github.com/anbox/anbox-modules.git

Install the configuration file:

cd ~/anbox-modules
sudo cp anbox.conf /etc/modules-load.d/
sudo cp 99-anbox.rules /lib/udev/rules.d/

Next, copy the module source to /usr/src/:

sudo cp -rT ashmem /usr/src/anbox-ashmem-1
sudo cp -rT binder /usr/src/anbox-binder-1

Finally use dkms to build and install:

sudo dkms install anbox-ashmem/1
sudo dkms install anbox-binder/1
sudo apt install software-properties-common
sudo add-apt-repository ppa:morphis/anbox-support
sudo apt update
sudo apt install linux-headers-generic anbox-modules-dkms

In order to obtain the Anbox kernel modules of other distributions, please checkout Anbox kernel module Gi​​tHub page

The anbox kernel module is now installed, but we are more than that. Next, we must manually load the kernel modules, don’t worry, they will be loaded automatically the next time the system starts.

sudo modprobe ashmem_linux
sudo modprobe binder_linux

Use one of the following three methods to confirm that there are two new modules in the system.

$ lsmod | grep -e ashmem_linux -e binder_linux

## You should see an output like:
binder_linux          110592  0
ashmem_linux           16384  0

$ ls -alh /dev/binder /dev/ashmem

## You should see an output like:
crw------- 1 root root  10, 58 Aug  3 21:43 /dev/ashmem
crw------- 1 root root 511,  0 Aug  3 21:43 /dev/binder

$ ls -1 /dev/{ashmem,binder}

## You should see an output like:
/dev/ashmem
/dev/binder

Step 3: Install the inbox

In this step, we will install Anbox Snapshot from the store, which will provide you with everything you need to run a full Anbox experience. Let’s install it by running the following command:

$ sudo snap install --devmode --beta anbox

Download snap "anbox" (186) from channel "beta"                                                                       35% 1.42MB/s 2m59s

Before you start using the Android application on Linux, please take some time to make it complete.

Anbox starts

How to use Anbox to run Android applications on Linux

Anbox default application

How to use Anbox to run Android applications on Linux

Currently, since Anbox capture has not been fully restricted, the anbox team needs to use –devmode. Work on the upstream snapshot project has begun to gain support for full restrictions. As a side effect of using –devmode, the snapshot will not be updated automatically. In order to update to a newer version, you can run:

snap refresh --beta --devmode anbox

Step 4: Install Android application on Anbox

Anbox is not included with the Google Play Store. Having said that, we must find other ways to install our Apps, one of which is through the Android Debug Bridge (ADB). We need the Android Debug Bridge (ADB) to manually push the Android APK to the virtual Android you installed in Anbox. We are already step 1.

In addition, you may have guessed that we need another app store to download Android apps. Fortunately, there are other stores, such as APK mirror. Visit the site in your Ubuntu 20.04 and download the required applications. Also, make sure to select an x86 APK file. This is because you are emulating Android on a regular 64-bit CPU instead of ARM.

[email protected]:~/Downloads$ ls
'com.whatsapp_2.20.195.17-204517002_minAPI15(x86)(nodpi)_apkmirror.com.apk'

Start adb, because it is usually closed by executing the following command by default.

$ adb devices

List of devices attached
* daemon not running; starting now at tcp:5037
* daemon started successfully
emulator-5558    attached

Install the application

adb install com.whatsapp_2.20.195.17-204517002_minAPI15(x86)(nodpi)_apkmirror.com.apk 
Success

Confirm that the application has been successfully installed in Anbox.

How to use Anbox to run Android applications on Linux

in conclusion

Anbox is a constantly evolving application, and it may not work as perfectly as you expect. Some applications are interrupted, while other applications are normal. Give is an attempt. Please contact the Anbox team on Git and be happy to explore the services it provides. We thank you for standing by your side and staying till the end. You can view other articles below.

How to transfer everything from old Android to new Android

How to track iPhone from Android phone

Coolmuster Lab.Fone for Android: Undelete files on Android-fast and safe

Android related learning materials:


The complete Android N developer course

The complete Android N developer course

★★★★☆
(26337)

$ 15.40

$ 153.95

In stock

Buy now

How to use Anbox to run Android applications on LinuxUdemy.com


The complete Android Oreo developer course-build 23 applications!

The complete Android Oreo developer course-build 23 applications!

★★★★☆
(12421)

$ 15.40

$ 153.95

In stock

Buy now

How to use Anbox to run Android applications on LinuxUdemy.com

You can download this article in PDF format via the link below to support us.

Download the guide in PDF format

turn off
To

To
To

Sidebar