Site icon Free Linux Tutorials

Run Android Apps on Linux : Install Anbox and Google Playstore on Ubuntu

If you come from Windows and you are used to running Android emulators like Bluestacks, don’t worry Linux has a lot of ways to run Android apps, one way is using Anbox.

Android in a Box or “Anbox” as per official website definition, puts the Android operating system into a container, abstracts hardware access and integrates core system services into a GNU/Linux system. Every Android application will be integrated with your operating system like any other native application.

A. Install Kernel modules via PPA

-need to install two(2) Dynamic Kernel Module Support or DKMS  based kernel modules for ashmem and binder for the Android container to work

1. Add PPA to your system

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

2. Load the kernel modules. It will automatically loaded once you boot up again.

sudo modprobe ashmem_linux
sudo modprobe binder_linux

3. Verify if it is already in your /dev directory

ls -1 /dev/{ashmem,binder}

Note: If you happen to see that the binder cannot find, don’t worry should be good as it is a bug.

tux@FreeLinux:~/anbox-modules$ ls -1 /dev/{ashmem,binder}
ls: cannot access ‘/dev/binder’: No such file or directory
/dev/ashmem

To verify use this command (you should see the 2 modules loaded)

lsmod | egrep “binder|ashmem”

Sample Output:

tux@FreeLinux:~/anbox-modules$ lsmod | egrep “binder|ashmem”
binder_linux 196608 0
ashmem_linux 20480 0

B. Install Anbox via Snap

1. Install Anbox snap

snap install –devmode –beta anbox

Sample Output:

tux@FreeLinux:~/anbox-modules$ snap install –devmode –beta anbox
anbox (beta) 4-56c25f1 from Simon Fels (morphis) installed

2. Update to newer version

snap refresh –beta –devmode anbox

snap refresh –devmode –edge anbox

Sample Output:

tux@FreeLinux:~/anbox-modules$ snap refresh –beta –devmode anbox
snap “anbox” has no updates available

tux@FreeLinux:~$ snap refresh –devmode –edge anbox
anbox (edge) 4+gitrad377ff from Simon Fels (morphis) refreshed

3. Verify

snap info anbox

Sample Output:

tux@FreeLinux:~/anbox-modules$ snap info anbox
name: anbox
summary: Android in a Box
publisher: Simon Fels (morphis)
store-url: https://snapcraft.io/anbox
contact: https://anbox.io
license: unset

C. Installing Android Application

1.Install Android Debug Bridge (ADB) package

sudo apt install android-tools-adb

tux@FreeLinux:~/Downloads$ sudo apt install android-tools-adb
[sudo] password for tux:
Reading package lists… Done
Building dependency tree
Reading state information… Done
Setting up adb (1:8.1.0+r23-5ubuntu2) …
Setting up android-tools-adb (1:8.1.0+r23-5ubuntu2) …
Processing triggers for man-db (2.9.1-1) …
Processing triggers for libc-bin (2.31-0ubuntu9.2) …

2. Anbox do not have the capability to find and download Android apps for you automatically(unless you install Google Playstore). You need to download it manually and install it. There are few ways to do this. Download via the APK downloader website (apps.evozi.com)

a. Go to playstore (play.google.com)
b. Search for the apps you want to install
c.Click the 3 dots to share and copy link
d. Generate download link via https://apps.evozi.com/apk-downloader/ 
e. Download the apk
f. Install the apk via adb

adb install <apkname.apk>

D. Install Google Play Store and enable ARM applications support

1. Install needed dependencies

sudo apt install wget curl lzip tar unzip squashfs-tools

2. Download the playstore script

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

If you are interested with the code you can find it here: https://github.com/geeks-r-us/anbox-playstore-installer/

3. Make the script executable

chmod +x install-playstore.sh

4. Run the script

./install-playstore.sh

Sample Output:

tux@FreeLinux:~/Downloads$ ./install-playstore.sh
Restarted.
/var/snap/anbox/common/rootfs-overlay
/home/tux/Downloads/anbox-work
Extracting anbox android image
Parallel unsquashfs: Using 8 processors
1836 inodes (8401 blocks) to write
[=================================================================================================================================-] 8401/8401 100%

created 1659 files
created 280 directories
created 177 symlinks
created 0 devices
created 0 fifos
Loading open gapps from https://sourceforge.net/projects/opengapps/files/x86_64/20210820/open_gapps-x86_64-7.1-pico-20210820.zip

5. Find the Anbox Application Manager under “Applications” or run this via terminal:

anbox.appmgr

Sample Look:

 

 

Additional Notes:

If encounter errors, enable debug logs

sudo snap set anbox debug.enable=true

Run the logs collection utility

/snap/bin/anbox.collect-bug-info

Find any interesting logs here:

sudo tail -f /var/snap/anbox/common/data/system.log

If no sounds, you can try this as well:

cd /var/snap/anbox/common/rootfs-overlay/system/etc
sudo wget https://raw.githubusercontent.com/anbox/anbox/master/android/media/media_codecs.xml
sudo wget https://raw.githubusercontent.com/anbox/anbox/master/android/media/media_codecs_google_audio.xml
sudo wget https://raw.githubusercontent.com/anbox/anbox/master/android/media/media_codecs_google_telephony.xml
sudo wget https://raw.githubusercontent.com/anbox/anbox/master/android/media/media_codecs_google_tv.xml
sudo wget https://raw.githubusercontent.com/anbox/anbox/master/android/media/media_codecs_google_video.xml
sudo wget https://raw.githubusercontent.com/anbox/anbox/master/android/media/media_profiles.xml
sudo snap set anbox rootfs-overlay.enable=true
sudo snap stop anbox
sudo snap start anbox

Exit mobile version