# Android Emulation
***Last Updated: [[2023-10-14]] ***
Getting [[Android]] apps running on [[Solus]] isn't trivial.
From my research there are *zero* maintained Android compatibility layers available for Linux other than Waydroid. And [Waydroid](https://github.com/waydroid/waydroid) isn't an option because Solus doesn't support [[Wayland]].
Budgie doesn't support Wayland [yet](https://buddiesofbudgie.org/blog/wayland), but it is expected to fully switch from X11 by the time of the next major release (Budgie 11). When this happens, it is likely that Solus will soon follow.
In the meantime the only maintained option is the one that ships with Android Studio:
- [Android Virtual Device](https://developer.android.com/studio/run/emulator#install) (part of the Android Studio SDK)
And then there are two commonly suggested Android for [[x86]] ROMs which can be run in a traditional virtual machine:
- [Android-x86](https://www.android-x86.org/)
- [Bliss OS](https://blissos.org/) (also works on on real [[x86]] hardware)
## References
- https://lifehacker.com/how-to-run-android-apps-inside-chrome-on-any-desktop-op-1637564101
- https://wiki.archlinux.org/title/Android#Run_Android_apps_on_Arch_Linux
# Using Anbox
>[!WARNING]
> Anbox's development was discontinued on [[2023-02-03|February 3rd, 2023]]. As soon as there is another viable alternative, this entire section will be demoted to a single bullet point.
> The Anbox project [was once ago created in 2017](https://www.omgubuntu.co.uk/2017/04/android-apps-linux-desktop-anbox) to bring Android to any Linux based desktop operating system. It's development has however stalled in the past years and it's only fair to say that now in 2023 it's no longer actively developed.
\- [Official Anbox Repo](https://github.com/anbox/anbox#readme)
***Last Updated: Dec 2021***
Anbox is limited to [[Android]] 7 and requires manually building kernel modules because Solus doesn't support DKMS.
### Building Anbox
You will need the standard dev tools and headers for your kernel:
```shell
sudo eopkg install -c system.devel
sudo eopkg install linux-current-headers
```
(or `linux-lts-headers` if you're on the LTS kernel)
Use these steps from a Solus Discuss [thread](https://discuss.getsol.us/d/2043-how-to-get-anbox-working-on-solus-5-2-2-122-current) by [huebi](https://discuss.getsol.us/u/huebi) to do the setup:
1. `sudo eopkg install android-tools`
2. load binder and ashmem kernel module
2.1 as Solus does not support DKMS we have to manually load binder and ashmem
2.2 [https://github.com/anbox/anbox-modules](https://github.com/anbox/anbox-modules) download the modules here
2.3 copy the binder module folder to /usr/src/
2.4 compile it using the following commands inside the folder
`sudo make`
`sudo make install`
2.5 load the kernel module `sudo insmod /binder_linux.ko` has to be done after every reboot (optional: I use a cronjob for that)
2.6 rinse and repeat with the ashmem module
3. install the anbox snap `$ snap install --devmode --beta anbox` (might need root permission)
4. `anbox session-manager` (run in Terminal) (ideally this task is automated as well, using the same cronjob that's loading the kernel modules, after modules are loaded)
5. `anbox.appmgr` (run in separate Terminal)
As of [[2021-12-11]] you have to use a fork of the modules repo because Anbox's devs apparently use ancient kernels:
https://github.com/choff/anbox-modules.git
In [this gist](https://gist.github.com/acook/cfa64c38ffc253d0b9030ab0d0c8bc0d#file-anbox_solus_install-bash) is a modified version of the `INSTALL.SH` script that comes with the Anbox module repo. Run it to build and install the modules, you will need to type in your `sudo` password:
```shell
./anbox_solus_install.bash
```
Additionally you may need to edit `binder/Makefile` to ignore an error in order for it to compile:
```ini
-Wno-error=incompatible-pointer-types
```
## Troubleshooting
Ask Anbox to do a self-check:
```shell
anbox check-features
```
Verify that the modules are loading and creating the proper devices:
```shell
sudo modprobe ashmem_linux
sudo modprobe binder_linux
lsmod | grep -e ashmem_linux -e binder_linux
ls -alh /dev/binder /dev/ashmem
```
Output should look something like this:
```
binder_linux 114688 0
ashmem_linux 16384 0
crw-rw-rw- 1 root root 10, 55 Jun 19 16:30 /dev/ashmem
crw-rw-rw- 1 root root 511, 0 Jun 19 16:30 /dev/binder
```
## References
- https://discuss.getsol.us/d/2043-how-to-get-anbox-working-on-solus-5-2-2-122-current
# Others Not Recommended
Listed here for posterity.
- [ARChon](https://archon-runtime.github.io/) (run Android apps in Chrome, **abandoned since 2020**)