Installing Anbox on Linux to Run Android Apps

Anbox is an Android emulator that is available for any GNU/Linux operating system. An android emulator offers the environment necessary for installing and running Android apps. Such emulators do not offer the portability of an Android smartphone, but in exchange, more powerful hardware can be used.In this article, we will show you how to install Anbox on Linux.

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:

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

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:

$ apt install dkms linux-headers-amd64

Ubuntu:

$ sudo apt install dkms linux-headers-generic

For CentOS, RHEL, and derivatives:

$ sudo yum install dkms kernel-devel

For openSUSE, SUSE Linux and derivatives:

$ sudo zypper install dkms kernel-default-devel

Now, let’s install the Anbox kernel modules, which are directly available in the Anbox GitHub module repo.

$ git clone https://github.com/anbox/anbox-modules.git

Run the installation script.

$ sudo ./INSTALL.sh

The modules must be manually loaded. Alternatively, you can restart the system to load them by default.

$ sudo modprobe ashmem_linux && sudo modprobe binder_linux

Now, the following command can be used to show if there are two new nodes under the /dev directory.

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

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.

$ sudo snap install --devmode --beta anbox

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.

$ sudo snap refresh --beta --devmode anbox

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:

$ sudo apt install android-tools-adb

For Fedora and derivatives:

$ sudo dnf install android-tools

For Arch Linux and derivatives:

$ sudo pacman -S android-tools

For openSUSE, SUSE Linux and derivatives. Check out Android tools at openSUSE:

$ sudo zypper install android-tools

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.

$ adb devices

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.

$ adb install <filename>.apk

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:

$ sudo apt install wget curl lzip tar unzip squashfs-tools

For Fedora and derivatives:

$ sudo dnf install wget curl lzip tar unzip squashfs-tools

For Arch Linux and derivatives:

$ sudo pacman -S wget curl lzip tar unzip squashfs-tools

Now, download the script.

$ wget https://raw.githubusercontent.com/geeks-r-us/anbox-playstore-installer/master/install-playstore.sh

Mark the script as an executable file.

$ chmod +x install-playstore.sh

Run the script.

$ ./install-playstore.sh

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!



from Linux Hint https://ift.tt/37GKBPw

Post a Comment

0 Comments