Home Ubuntu How to install and run Android Apps on Ubuntu using Anbox

How to install and run Android Apps on Ubuntu using Anbox

by Hend Adel
Published: Updated:
Run Android Apps on Linux

Have you ever thought about running an Android app or a game on your Linux system? Android and Linux are close relatives, and there is no hard reason why it’s not worth imagining. A new promising project “Anbox” is on course to be a wonderful application for Linux users.

Anbox is a Linux system emulation tool. It can act as a layer between Android apps and your Linux system that are purely coded. It allows you to run and execute android applications on your Linux system.

Note that Anbox is not the first Android emulator for Linux. Projects like Shashlik or Genimobile too use an emulator to run Android. These emulators create a whole emulated system with its own kernel. On the other hand, Anbox runs the Android system under the same kernel as the host operating system. No emulation layer like QEMU is needed. All runs directly on hardware. It also allows for much better integration with the host operating system.

Anbox places the Android OS in a container that summarizes hardware access and integrates core service systems into a Linux system. Like any other native application, each Android application is integrated with your operating system.

Installing Anbox on Ubuntu

In this tutorial, we will walk you through the Anbox installation and configure your Linux to run any Android application. Though it is not an easy task, we will try to make it simpler for you.

Step 1 – System Update

Before starting our tutorial, you need first to ensure that your system is up-to-date. Launch the Terminal and enter the following commands:

sudo apt-get update
sudo apt-get upgrade

Step 2 – Add Anbox Repo to your system

In this section, we will add the PPA to your Linux system and install the essential and appropriate anbox-modules-dkms package, which contains the kernel modules.

Add Anbox repository to your system.

sudo add-apt-repository ppa:morphis/anbox-support
Enable Anbox Kernel Modules

Enable Anbox Kernel Modules

Update your system.

sudo apt update
Update Repository

Update Repository

Step 3 – Install Kernel Modules

Install appropriate kernel modules using the following commands:

sudo apt install anbox-modules-dkms

Start kernel modules manually:

sudo modprobe ashmem_linux
sudo modprobe binder_linux
Setting up Kernel Modules

Setting up Kernel Modules

Step 4 – Verify Kernel Modules

Now, let’s verify that new kernel modules have been installed successfully.

ls -l /dev/{ashmem,binder}

The output of the previous command should look like the below screenshot.

Verify Installed Kernel Modules

Verify Installed Kernel Modules

Step 5 – Anbox Installation using Snap

Now we will install the Anbox using the snap command.

First, ensure that you have snap installed. Ubuntu 18.04 and above should come with snap installed by default. If not, you can install snap using our guide.

snap --version
Snap Version

Snap Version

Install Anbox. Note that since it is still in the development phase, we will download the beta version.

sudo snap install --devmode --beta anbox
Install Anbox

Install Anbox

After the installation completes the output successfully should look like below.

Anbox Installed Successfully

Anbox Installed Successfully

Step 6 – Android Studio Installation

Since Anbox is an emulation tool for Android, you also need to install Android development tools to install apps on it.

Begin with the installation of Java for Linux.

sudo apt install openjdk-11-jdk
Install Java For Linux

Install Java For Linux

Download Android Studio: Unfortunately, the Android studio application has no downloadable binary package. Download your development suite for Linux:

Click here for the download page.

After the download completes, you can go back to your terminal and extract the Android Studio.

cd ~/Downloads
unzip android-studio-ide-*-linux.zip

Now move to the Android Studio bin directory to start the installation process.

cd android-studio/bin

Run the Android Studio installation script.

./studio.sh

When the Android Studio Wizard starts, a welcome screen will appear like the below. Press next to continue.

Android Studio Welcome Screen

Android Studio Welcome Screen

Choose the Standard option then press next to continue.

Select Standard Option

Select Standard Option

Select your user interface theme as below.

Select UI Theme

Select UI Theme

Verify your installation settings and press next to start the installation process.

Verify Android Studio Settings

Verify Android Studio Settings

When the installation completes successfully you will get a summary screen as below.

Android Studio Installation Completes Successfully

Android Studio Installation Completes Successfully

Now you can start a new Android Studio Project.

Start New Android Project

Start the New Android Project

Step 7 – Install Android Command Line Tools

sudo apt install android-tools-adb
Install ADB

Install ADB

Step 8 – Start ADB Server

For now the Anbox is ready to go but first, you need to start up the ADB server.

adb start-server
Start up the ADB server.

Start up the ADB server.

Step 9 – Download your Android app or a Game

For example, let’s search for a game to download. APK Mirror is a great resource to find downloadable Android games in APK format.

Go to APK mirror to download your intended game. For now, note that not all the Android games will work correctly on Anbox. Also for better configurations, you need to install the x86 version from your game.

Step 10 – Install and Configure APK

After downloading your game APK. Go to the downloads directory.

cd ~/Downloads

Install the game APK using the below command.

adb install game.apk
APK Installed Successfully

APK Installed Successfully

Open the Anbox Application Manager from your applications.

Anbox Application Manager

Anbox Application Manager

Step 11 – Launch your Android App or Game!

Start Your Game

Start Your Game

Voila, you now have Android app on your Linux system! That’s all about configuring Anbox on your Linux system to run Android Apps. You can now enjoy playing your Android games on your Linux.

Finally, I hope you have enjoyed this tutorial. Your feedback and questions are welcome.

You may also like

48 comments

fossit April 13, 2019 - 1:29 AM

thanks for the detailed instructions.
the command line in step 7 should be sudo apt install android-tools

Reply
Kiran Kumar April 13, 2019 - 9:59 AM

Thanks for leaving your valuable feedback. We see that the command line is good in the screenshot. We corrected the typo in the command-line.

Reply
Roberto April 12, 2022 - 2:00 AM

Its the difference of Ubuntu and Fedora I think!

Reply
Richard Holmes July 12, 2019 - 9:38 PM

Is there something missing in these instructions? You say “Now you can start a new Android Studio Project” but you do not say what to do in Android Studio after clicking on “Start a New Android Studio Project”.

I ignored that and proceeded but adb install did not work:

adb install ‘com.codebrewgames.pocketcity_1.1.134-10234_minAPI18(arm64-v8a,armeabi,armeabi-v7a,x86,x86_64)(nodpi)_apkmirror.com.apk’
error: no devices/emulators found
adb: error: failed to get feature set: no devices/emulators found
– waiting for device –

Reply
Tiger-Uppercut July 14, 2019 - 11:05 PM

adb start-server
Launch Anbox Application Manager
adb install game.apk

You should now see the Game/App listed in your Anbox Application Manager

Reply
Lászó Richter April 2, 2020 - 1:32 PM

Hi,
Unfortunately, the same mistake was made to me, and the answer in the reply did not solve the problem.
Same with:
error: no devices / emulators found
adb: error: failed to get feature set: no devices / emulators found
– waiting for device –
Please help me.
Thank you.

Reply
Attila April 18, 2020 - 7:38 AM

On Arch I had the same problem. I installed anbox-launchers-git then I got an “Anbox” GUI application and when I ran it it started up things nicely. Not sure how to achieve that from command line, neither do I care.

Reply
DD May 15, 2020 - 10:04 PM

Same problem on snap anbox running on xubuntu 20

~/Downloads$ adb install [downloaded-game].apk
error: device offline
adb: error: failed to get feature set: device offline
– waiting for device –

Reply
luis June 8, 2020 - 2:51 AM

Im amazed how we are totally ignored.
By the way im having the same issue.

elkrari February 23, 2021 - 5:03 PM

Got the same issue… Open the Anbox Application Manager and try again.

Reply
Janks July 22, 2019 - 4:36 AM

So everything went well until

$ abd install com.vectorunit.cobalt.googleplay_1.4.2-160_minAPI19(arm64-v8a,armeabi-v7a)(nodpi)_apkmirror.com.apk
bash: syntax error near unexpected token `(‘

what does that mean?

Reply
Kris August 24, 2019 - 9:36 AM

Looks like you typed abd instead of adb unless that is a typo

Reply
NA September 4, 2020 - 1:35 PM

You have a syntax error at `(‘. The ‘(‘ symbol needs to be escaped with \ or put inside quotes.

So do:
abd install “com.vectorunit.cobalt.googleplay_1.4.2-160_minAPI19(arm64-v8a,armeabi-v7a)(nodpi)_apkmirror.com.apk”

Or
abd install com.vectorunit.cobalt.googleplay_1.4.2-160_minAPI19\(arm64-v8a,armeabi-v7a\)\(nodpi\)_apkmirror.com.apk

Reply
Titty August 9, 2019 - 3:37 AM

Good article bro thanks dude man

Reply
willy September 8, 2019 - 10:15 PM

Please info sir, How to remove anbox with all the files installed above. Thank you.

Reply
Hend Adel October 21, 2019 - 3:29 PM

Hello Willy,

To remove anbox you can execute the below 3 commands:
1. snap remove anbox
2. sudo apt install ppa-purge
3. sudo ppa-purge ppa:morphis/anbox-support

Also you can check the anbox official uninstall guide here: https://docs.anbox.io/userguide/install.html#uninstall-anbox

Reply
sultan May 17, 2020 - 2:42 AM

I’ve installed the “Google Play” and it launches on anbox, but when I click the “Sign In” – nothing happens. Is there a way to open a debug terminal and see the error?

Reply
Óscar Daniel Hernández Olvera September 15, 2019 - 3:39 PM

Hi, how are you. I’m getting this error:
adb: failed to install mobdro.apk: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]

Is it something I did wrong ?

Reply
Andrew October 20, 2019 - 4:40 PM

I have the same problem

Reply
Hend Adel October 21, 2019 - 3:21 PM

Hello,
The “INSTALL_FAILED_NO_MATCHING_ABIS” appears when you are trying to install an app that has native libraries and it doesn’t have a native library for your cpu architecture. Kindly check below link: https://askubuntu.com/questions/903995/no-matching-abis-error-when-installing-some-android-apps-in-anbox

Reply
Sara October 25, 2019 - 3:13 PM

Hi!
It doesn’t work for me, I do everything you ask but when I start the app it always closes before it starts. I don’t undertand…

Reply
Hend Adel October 26, 2019 - 4:10 PM

Hello Sara,
Please open your terminal and run the next command to open the anbox session manager:
anbox session-manager
Next click on the Anbox icon from launcher. If this opens the app then all you need is to add the anbox service to the Startup Applications. Otherwise open the anbox logs and post the error here.

Reply
Queenie October 26, 2019 - 4:52 PM

I don’t really understand how to launch Anbox itself. I tried using the “anbox” command in terminal and get:

“Command ‘anbox’ is available in ‘snap/bin/anbox’
The command could not be located because ‘snap/bin’ is not included in the PATH environment variable.
anbox: command not found”

Not sure what to do at this point. I also don’t know how to re-open Android Studio once I’ve closed it. I’m basically at a point where I’ve followed these instructions to install a bunch of things I have no clue how to run. The last I got to was step 10 of trying to install the apk but was told there were no devices/emulators found.

Reply
Hend Adel October 27, 2019 - 4:02 PM

Hi,

You can start the Anbox from:
1. From your Ubuntu desktop.
2. Open show applications from the left Unity dock.
3. In the search bar, search for anbox and open it.

For the “no devices emulators error”:
Try installing different apk and kindly note that “as mentioned in the article” not all the Android games will work correctly on Anbox. Also for better configurations, you need to install the x86 version from your game.

Reply
Packagen November 28, 2019 - 8:51 AM

Hi, how are you. I’m getting this error:
error: snap “anbox” is not available on beta for this architecture (i386) but exists on
other architectures (amd64).

Reply
Hend Adel December 2, 2019 - 9:42 AM

Hi,

Please ensure that the required anbox-modules-dkms package is installed and loaded successfully. One more thing if your are running a 32-bit system, note that Anbox is not support on i386 as mentioned here:
https://github.com/anbox/anbox/issues/1208

Reply
Mike December 29, 2019 - 12:20 PM

Hi,

I have followed all the instructions above without any problems but when I go to launch the ‘Anbox Application Manager’ it fails. When I click on the application it launches a new window with the android icon in the middle and the text ‘Starting …’ but after a few seconds this window just disappears. Note that I have not yet installed any app apks but I was still expecting the Anbox Application Manager to show an empty window once it had started. Is this what is expected ? After the ‘Starting …’ window has disappeared if I type ‘top’ at the Linux command line I can see that there is a ‘anbox’ process running on my system but there is no graphical interface.
The same thing happens if I issue the command at the Linux command line:
anbox session-manager
Is this normal ? Will I only see a graphical interface to anbox after I have installed some apk files ?

Thanks
Mike

Reply
Sergio January 24, 2020 - 2:37 AM

Hello!
Thank you for the good and comprehensive article.
I’ve build anbox from sources, cause my OS is Debian 9. All is built well. The anbox-modules are in system {ashmem, binder}. But anbox isn’t run. How to run it from terminal?
I’ve read that it’s necessary to run services first.

Reply
fateh March 16, 2020 - 6:04 PM

hi
is there any way to grt network on anbox cause its not working with me
thnx

Reply
Hagai March 16, 2020 - 11:25 PM

I’ve installed the “Google Play” and it launches on anbox, but when I click the “Sign In” – nothing happens. Is there a way to open a debug terminal and see the error?

Reply
John Baker March 24, 2020 - 12:38 AM

After installing anbox-modules-dkms package I ran the following commands:
sudo modprobe ashmem_linux
sudo modprobe binder_linux
I received the following error message:
modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file ‘/lib/modules/4.4.0-18362-Microsoft/modules.dep.bin’
modprobe: FATAL: Module ashmem_linux not found in directory /lib/modules/4.4.0-18362-Microsoft

Can you please help me to resolve this error?
John

Reply
László Richter April 2, 2020 - 2:26 PM

And next error:

at ‘sudo snap install –devmode –beta anbox’ writes the following error message:

“It is missing support for the following features: SSE 4.1, SSE 4.2, SSSE 3
You can for example find more information about SSE
here https://en.wikipedia.org/wiki/Streaming_SIMD_Extensions

How can this be solved?
Please help me.
Thanks.

Reply
Eveline April 3, 2020 - 10:27 AM

Hello,
Thank you for the tutorial.
I’m a newbie on installing things, I have elementary OS Hera.
When doing the command: ‘sudo apt install anbox-modules-dkms’ I get the following outcome:
‘Error! Bad return status for module build on kernel: 5.3.0-45-generic (x86_64)
Consult /var/lib/dkms/anbox/1/build/make.log for more information.
I don’t know what to do now? Any help would be welcome!
Thanks!

Reply
Jan Vorel April 8, 2020 - 3:27 PM

Hello,
thank you for the clear tutorial.
Please in my installation the new installed apps are not displayed in Anbox application manager. In setting I can see that they are instaled, but not displayed.
Thanks

Reply
sultan May 17, 2020 - 2:44 AM

I’ve installed the “Google Play” and it launches on anbox, but when I click the “Sign In” – nothing happens. Is there a way to open a debug terminal and see the error?

Reply
Antonio Mihovilovic June 22, 2020 - 11:02 AM

sudo snap install –devmode –beta anbox
error: cannot perform the following tasks:
– Run install hook of “anbox” snap if present (run hook “install”:
—–
realpath: ”: No such file or directory
realpath: ”: No such file or directory
realpath: ”: No such file or directory
realpath: ”: No such file or directory
realpath: ”: No such file or directory
realpath: ”: No such file or directory
realpath: ”: No such file or directory
realpath: ”: No such file or directory
The CPU of your computer (Intel(R) Core(TM)2 Duo CPU E7500 @ 2.93GHz) does not support all
features Anbox requires.
It is missing support for the following features: SSE 4.2
You can for example find more information about SSE
here https://en.wikipedia.org/wiki/Streaming_SIMD_Extensions
—–)
Any suggestions?

Reply
Antonio Mihovilovic June 22, 2020 - 11:25 AM

—then I tried to install it on my new laptop and got this:
ERROR: Cannot create report: [Errno 17] File exists: ‘/var/crash/anbox-modules-dkms.0.crash’
Error! Bad return status for module build on kernel: 5.3.0-28-generic (x86_64)
Consult /var/lib/dkms/anbox/1/build/make.log for more information.
root@tsrbsve-HP-ProBook-455R-G6:/#

Any suggestions?

Reply
teset October 13, 2020 - 7:34 AM

sudo apt-add-repository –remove ppa:morphis/anbox-support

Reply
SRINIVASA PRASAD July 16, 2020 - 11:37 AM

Wow… Excellent. It worked for me. Thanks a ton…. Perfect and easy to follow instructions and details. Hats off to you.

Reply
Philip September 25, 2020 - 9:28 AM

I’m getting:
Unpacking anbox-modules-dkms (13) …
Setting up anbox-modules-dkms (13) …
Loading new anbox-1 DKMS files…
Building for 5.4.0-48-generic
Building initial module for 5.4.0-48-generic
Error! Bad return status for module build on kernel: 5.4.0-48-generic (x86_64)
Consult /var/lib/dkms/anbox/1/build/make.log for more information.
And in the log:
/var/lib/dkms/anbox/1/build/binder/binder.c:3382:11: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
.fault = binder_vm_fault,
^~~~~~~~~~~~~~~
/var/lib/dkms/anbox/1/build/binder/binder.c:3382:11: note: (near initialization for ‘binder_vm_ops.fault’)
cc1: some warnings being treated as errors
scripts/Makefile.build:273: recipe for target ‘/var/lib/dkms/anbox/1/build/binder/binder.o’ failed

Reply
Jane Ornby June 5, 2021 - 7:58 AM

I got the same problem:
DKMS make.log for anbox-1 for kernel 5.4.0-58-generic (x86_64)


/var/lib/dkms/anbox/1/build/binder/binder.c:3382:11: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
.fault = binder_vm_fault,
^~~~~~~~~~~~~~~
. . . . . .
scripts/Makefile.build:273: recipe for target ‘/var/lib/dkms/anbox/1/build/binder/binder.o’ failed
make[2]: *** [/var/lib/dkms/anbox/1/build/binder/binder.o] Error 1

Reply
Abitan Shrestha December 12, 2020 - 1:03 AM

“sudo modprobe ashmem_linux “this problem occur when i was installing kernal modules what should i do?

Reply
QRP March 3, 2021 - 7:20 PM

Hi, thanks for the It’s Foss tutorials, I’m trying to keep up.
I’m having a problem at Step 3, Install Kernel Modules:

$ sudo apt install anbox-modules-dkms
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package anbox-modules-dkms

Now what?

Reply
QRP March 3, 2021 - 7:21 PM

OS: Ubuntu 20.10 x86_64
Kernel: Linux 5.8.0-44-generic
Shell: /bin/bash 5.0.17
DE: GNOME 3.38.2
CPU: Intel i7-10510U (8) @ 4.900GHz [47.0°C]
GPU: Intel UHD Graphics
Memory: 3.36GiB / 15.33GiB (21%)
Host: N141CU
Uptime: 3h 13m
Packages: 2487 (dpkg), 9 (snap)
Resolution: 1920×1080 @ 59.93Hz
WM: Mutter
WM Theme: Adwaita
Theme: Yaru-dark
Icons: ubuntu-mono-dark
Terminal: gnome-terminal

Reply
Abebi July 8, 2021 - 7:53 AM

Hi
How can I fully remove anbox from ubuntu?

Reply
houstonembroideryservice November 19, 2021 - 12:18 AM

hi
is there any way to grt network on anbox cause its not working with me
thnx

Reply
dili January 26, 2022 - 5:54 AM

Hi

How can I install anbox from my pc with ubuntu software on my mobile with ubuntu touch install?

Thx in advance

Reply
Arno February 15, 2022 - 1:26 PM

I must say, this is a very bad guide

Reply

Leave a Comment

fl_logo_v3_footer

ENHANCE YOUR LINUX EXPERIENCE.



FOSS Linux is a leading resource for Linux enthusiasts and professionals alike. With a focus on providing the best Linux tutorials, open-source apps, news, and reviews written by team of expert authors. FOSS Linux is the go-to source for all things Linux.

Whether you’re a beginner or an experienced user, FOSS Linux has something for everyone.

Follow Us

Subscribe

©2016-2023 FOSS LINUX

A PART OF VIBRANT LEAF MEDIA COMPANY.

ALL RIGHTS RESERVED.

“Linux” is the registered trademark by Linus Torvalds in the U.S. and other countries.