Waydroid

Waydroid is the successor to Anbox, an Android emulator for running apps on Linux

Waydroid is still in early development and is not officially supported by the Mobian project. It is not available in Mobian repositories nor in the Debian “main” archive, which are the only ones enabled by default.

Do not expect the same performance you get from native apps, expect frequent crashes, difficult input, and high CPU usage.

Please keep in mind you will run into issues and report those directly to upstream.

Here be dragons.

Waydroid conflicts with Anbox. Make sure no components from Anbox are running before attempting to run Waydroid.
A complete Waydroid setup takes about 3.5 GB after the LineageOS image is downloaded and installed. Make sure you have enough storage available.

Method 1: build and install from source

Make a new directory and gather all the dependencies
mkdir Waydroid-build && cd $_
git clone https://github.com/sailfishos/libglibutil.git
git clone https://github.com/mer-hybris/libgbinder.git
git clone --single-branch --branch bullseye https://github.com/erfanoabdi/gbinder-python.git
Install the necessary Debian build tools
sudo apt install devscripts dh-make
Build and install Waydroid dependencies
cd libglibutil/
sudo apt build-dep .
debuild -us -uc
cd ..
sudo dpkg -i libglibutil*.deb
cd libgbinder/
sudo apt build-dep .
debuild -us -uc
cd ..
sudo dpkg -i libgbinder*.deb

gbinder-python has incomplete Debian packaging and needs a little more work, remember to update the git version number next time you build:

cd gbinder-python/
sudo apt build-dep .
dch --create --package "gbinder-python" --newversion "1.0.0~git20210909-1" foo bar
dh_make --createorig -p "gbinder-python_1.0.0~git20210909"
# Select "p" when prompted for the package type, leave the rest at the defaults
debuild -us -uc
cd ..
sudo dpkg -i python3-gbinder_1.0.0~git20210909-1_arm64.deb
Build and install Waydroid
git clone --single-branch --branch bullseye https://github.com/waydroid/waydroid.git
cd waydroid/
sudo apt build-dep .
debuild -us -uc
cd ..
sudo dpkg -i waydroid_1.0.0_all.deb 

Method 2: install from upstream repo

The upstream repository is maintained by Waydroid. Bugs should be filed to Waydroid, not Mobian.

See the official Desktop Install Instructions for bullseye.

After install

Manual workarounds to run on Mobian

Put the following in /etc/gbinder.conf:

[General]
ApiLevel = 29

Add psi=1 to the Linux command line (U_BOOT_PARAMETERS) by editing /etc/default/u-boot like this:

## /etc/default/u-boot - configuration file for u-boot-update(8)

U_BOOT_UPDATE="true"
U_BOOT_ALTERNATIVES="default"
U_BOOT_MENU_LABEL="Mobian GNU/Linux"
U_BOOT_PARAMETERS="console=ttyS0,115200 consoleblank=0 loglevel=7 rw splash plymouth.ignore-serial-consoles vt.global_cursor_default=0 psi=1"
U_BOOT_TIMEOUT="10"
U_BOOT_FDT_DIR="/dtb-"
Please review the above code and make sure it is accurate. Making changes to u-boot and running u-boot-update can cause your phone to not boot properly.

You now must run u-boot-update like this:

sudo u-boot-update

Restart so the boot option flag is enabled. After boot you can always check with this flag to ensure it is enabled:

cat /proc/cmdline

You should now see something like this “root=UUID=xxxxxx-xxxxx-xxxxxx console=ttyS0,115200 consoleblank=0 loglevel=7 rw splash plymouth.ignore-serial-consoles vt.global_cursor_default=0 psi=1

Initialize Waydroid
This step will download about 700-750 MB of data. Make sure you're not using a metered connection while running this command.

Waydroid needs to set up a downloaded LineageOS image and an LXC instance. To do that, run the following commands:

sudo apt install lxc
sudo systemctl enable waydroid-container.service

Restart the device so it's running the kernel with psi=1, then run this:

sudo waydroid init

These steps only need to be done once.

Running Waydroid

With the latest git version of Waydroid the application launchers added to the Phosh drawer should start the session manager automatically. Be patient when launching the first Android app after boot, the CPU is under very heavy load while the LXC container is booting.

It is also recommended to start something that doesn't show the onscreen keyboard, like the “Clocks” application, before tapping a Waydroid launcher. Otherwise the Waydroid session becomes cropped to the screen area above the onscreen keyboard.

If Waydroid becomes stuck on the screen (as in will not close), run waydroid session stop to stop the session manager and in turn the LXC container.

Optional tweaks

Hide launchers

If you want to keep the .desktop files but hide the launchers, add “NoDisplay=true” to those you dont want to see. The following hides all Waydroid launchers:

for i in ~/.local/share/applications/waydroid*desktop; do echo 'NoDisplay=true' >> $i; done

Remove launchers for redundant apps

# Calculator
truncate -s 0 ~/.local/share/applications/waydroid.com.android.calculator2.desktop
# Contacts
truncate -s 0 ~/.local/share/applications/waydroid.com.android.contacts.desktop
# Clocks
truncate -s 0 ~/.local/share/applications/waydroid.com.android.deskclock.desktop
# Files
truncate -s 0 ~/.local/share/applications/waydroid.com.android.documentsui.desktop
# Gallery
truncate -s 0 ~/.local/share/applications/waydroid.com.android.gallery3d.desktop
# Music
truncate -s 0 ~/.local/share/applications/waydroid.org.lineageos.eleven.desktop
# Browser
truncate -s 0 ~/.local/share/applications/waydroid.org.lineageos.jelly.desktop
# Recorder
truncate -s 0 ~/.local/share/applications/waydroid.org.lineageos.recorder.desktop
# Calendar
truncate -s 0 ~/.local/share/applications/waydroid.org.lineageos.etar.desktop

Disable suspend inside Waydroid

Some users have reported that suspend inside Waydroid causes instability, the following two properties will disable it:

waydroid prop set persist.waydroid.no_suspend true
waydroid prop set persist.waydroid.suspend false