Anbox - ArchWiki

# Anbox

From ArchWiki
Jump to navigation Jump to search

Anbox is a free and open-source compatibility layer that aims to allow mobile applications and mobile games developed for Android to run on GNU/Linux distributions. It executes the Android runtime environment by using LXC (Linux Containers), recreating the directory structure of Android as a mountable loop image, whilst using the native Linux kernel to execute applications.

## Installation

Make sure you have had the header files for your kernel installed (e.g. linux-headers for Linux kernel).

Install anbox-gitAUR, anbox-imageAUR (or anbox-image-gappsAUR if you want to include Google's Apps and houdini), anbox-modules-dkms-gitAUR

Start/enable the following services:

- `anbox-container-manager.service`

If you don't want to reboot your computer to enable the required DKMS modules, you can load them manually:

    # modprobe ashmem_linux
    # modprobe binder_linux

Note: There have been cases of conflicting packages while Installing anbox-gitAUR.

So make sure you install the Android Image (anbox-image-gappsAUR or anbox-imageAUR) first and then proceed to install the other Anbox packages.

See this link if you run into a common `logger.cpp` error.

## Network

### systemd-networkd

The package anbox-gitAUR uses `systemd-networkd` to enable networking in anbox.

Therefore you need to enable `systemd-networkd` or start `systemd-networkd` before starting `anbox-container-manager.service`.

### anbox-bridge script

Alternatively you can use the anbox-bridge script from https://raw.githubusercontent.com/anbox/anbox/master/scripts/anbox-bridge.sh

You must execute `anbox-bridge` every time before starting `anbox-container-manager.service` in order to get network working in anbox.

The easiest solution is create a drop-in file `enable-anbox-bridge.conf`.

    /etc/systemd/system/anbox-container-manager.service.d/enable-anbox-bridge.conf

    [Service]
    ExecStartPre=/usr/bin/anbox-bridge start

## Usage

You can run the Android applications on your desktop's launcher on Other category.

If you want to use adb to debug, install android-tools

    $ adb shell

### Installing apps through adb

By default, Anbox doesn't support for ARM applications. So apps must have a x86_64 architecture.

To install `/path/to/app.apk`

    $ adb install /path/to/app.apk

To get the list of installed applications

    $ adb shell pm list packages

Note that output will be similar to `package:app.name`, where `app.name` is different from the one displayed in anbox container.

To uninstall `app.name`

    $ adb uninstall app.name

If `app.name` is a system app

    $ adb uninstall --user 0 app.name

### Installing apps through apps stores

Apps can be easily installed through apps stores. In anbox-image-gappsAUR PlayStore is included.

## Troubleshooting

If kernels modules successfully loaded, service is running fine, and yet Anbox won't launch with `Application manager service is not running yet`. Check for the message `No space left on device - Failed to enter cgroup` in `/var/lib/anbox/logs/container.log`, you may be running into this issue.

Anbox doesn't seem to play nicely with LXC versions > 4.0.0.0 and fails with `Session manager failed to become ready.` downgrading to an older version of LXC fixes this. see this issue

Category:

- Virtualization