Waydroid: Difference between revisions

From NixOS Wiki
imported>Hypnosis2839
→‎Installation: simplify installation instructions, remove unnecessary module
Weijia (talk | contribs)
m Weijia moved page WayDroid to Waydroid: Misspelled title
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[https://waydro.id WayDroid] is an application which uses LXC containers to run Android applications on a non-Android system.  
[https://waydro.id Waydroid] is an application which uses LXC containers to run Android applications on a non-Android system.  


{{Warning|WayDroid requires a Wayland desktop session and cannot be used on X11.}}
{{Warning|Waydroid requires a Wayland desktop session and cannot be used on X11 directly, but can be run in a nested Wayland session, using e.g. [https://www.hjdskes.nl/projects/cage cage].}}
{{Warning|Installing WayDroid on your system before running nixos-generate-config will create unnecessary fstab entries that may interfere with system functionality.}}
{{Warning|Installing Waydroid on your system before running nixos-generate-config will create unnecessary fstab entries that may interfere with system functionality.}}


== Installation ==
== Installation ==


Enable WayDroid in your system configuration:
Enable Waydroid in your system configuration:


{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
Line 15: Line 15:




After rebuilding and switching, finish the WayDroid install in your shell.  
After rebuilding and switching, finish the Waydroid install in your shell.  


<syntaxhighlight lang="bash">
<syntaxhighlight lang="console">
# Fetch WayDroid images.
Fetch Waydroid images.
# You can add the parameters "-s GAPPS -f" to have GApps support.
You can add the parameters "-s GAPPS -f" to have GApps support.
sudo waydroid init
$ sudo waydroid init
</syntaxhighlight>
</syntaxhighlight>


Line 29: Line 29:
Start the container
Start the container


<syntaxhighlight lang="bash">
<syntaxhighlight lang="console">
# Start the WayDroid LXC container
Start the Waydroid LXC container
sudo systemctl start waydroid-container
$ sudo systemctl start waydroid-container
# You'll know it worked by checking the journal You should see "Started Waydroid Container".
sudo journalctl -u waydroid-container


# Start WayDroid session
You'll know it worked by checking the journal You should see "Started Waydroid Container".
# You'll know it is finished when you see the message "Android with user 0 is ready".
$ sudo journalctl -u waydroid-container
waydroid session start
 
Start Waydroid session
You'll know it is finished when you see the message "Android with user 0 is ready".
$ waydroid session start
</syntaxhighlight>
</syntaxhighlight>


General usage
General usage


<syntaxhighlight lang="bash">
<syntaxhighlight lang="console">
# Start Android UI
Start Android UI
waydroid show-full-ui
$ waydroid show-full-ui
# List Android apps
 
waydroid app list
List Android apps
# Start an Android app
$ waydroid app list
waydroid app launch <application name>
 
# Install an Android app
Start an Android app
waydroid app install </path/to/app.apk>
$ waydroid app launch <application name>
# Enter the LXC shell
 
sudo waydroid shell
Install an Android app
# Overrides the full-ui width
$ waydroid app install </path/to/app.apk>
waydroid prop set persist.waydroid.width 608
 
Enter the LXC shell
$ sudo waydroid shell
 
Overrides the full-ui width
$ waydroid prop set persist.waydroid.width 608
</syntaxhighlight>
</syntaxhighlight>


Line 63: Line 69:
Use following command to upgrade Android (LineageOS) to a newer version if available
Use following command to upgrade Android (LineageOS) to a newer version if available


<syntaxhighlight lang="bash">
<syntaxhighlight lang="console">
sudo waydroid upgrade
$ sudo waydroid upgrade
</syntaxhighlight>
</syntaxhighlight>


Line 72: Line 78:




<syntaxhighlight lang="bash">
<syntaxhighlight lang="console">
# Stop Waydroid container
Stop Waydroid container
sudo systemctl stop waydroid-container
$ sudo systemctl stop waydroid-container


# Removing images and user data
Removing images and user data
sudo rm -r /var/lib/waydroid/* ~/.local/share/waydroid
$sudo rm -r /var/lib/waydroid/* ~/.local/share/waydroid
</syntaxhighlight>
</syntaxhighlight>


Line 92: Line 98:
=== Linux 5.18+ ===
=== Linux 5.18+ ===


Linux 5.18 and later removed ashmem in favor of memfd, right now you need to tell waydroid (1.2.1 and later) to use the new module:
Linux 5.18 and later removed ashmem in favor of memfd, so you may need to tell Waydroid (1.2.1 and later) to use the new module:
{{file|/var/lib/waydroid/waydroid_base.prop|prop|<nowiki>
{{file|/var/lib/waydroid/waydroid_base.prop|prop|<nowiki>
sys.use_memfd=true
sys.use_memfd=true
Line 101: Line 107:
According to [https://github.com/waydroid/waydroid/issues/209 an upstream issue], changing the keyboard layout doesn't seem possible at the moment.
According to [https://github.com/waydroid/waydroid/issues/209 an upstream issue], changing the keyboard layout doesn't seem possible at the moment.


=== Missing umlaute or UTF8 support ===
=== Missing UTF-8 support ===


According to [https://github.com/waydroid/waydroid/issues/536 an upstream issue] Android might fail to display special characters correctly.
According to [https://github.com/waydroid/waydroid/issues/536 an upstream issue], Android might fail to display special characters correctly.


=== WayDroid interferes with suspend/hybernation ===
=== Waydroid interferes with suspend/hybernation ===


According to [https://github.com/waydroid/waydroid/issues/168 an upstream issue] WayDroid might interfere with suspend or hybernation. You might have to stop the Android session and container to suspend your machine correctly.
According to [https://github.com/waydroid/waydroid/issues/168 an upstream issue], Waydroid might interfere with suspend or hybernation. You might have to stop the Android session and container to suspend your machine correctly.


=== Clipboard share ===
=== Clipboard sharing ===


add `wl-clipboard` to `environment.systemPackages` and restart system, it should work now.
Add <code>wl-clipboard</code> to <code>environment.systemPackages</code>.


==See Also:==
==See Also:==


* [https://wiki.archlinux.org/title/Waydroid Waydroid article on the Archlinux Wiki]
* [https://wiki.archlinux.org/title/Waydroid Waydroid article on the Archlinux Wiki]

Latest revision as of 14:36, 3 April 2024

Waydroid is an application which uses LXC containers to run Android applications on a non-Android system.

Warning: Waydroid requires a Wayland desktop session and cannot be used on X11 directly, but can be run in a nested Wayland session, using e.g. cage.
Warning: Installing Waydroid on your system before running nixos-generate-config will create unnecessary fstab entries that may interfere with system functionality.

Installation

Enable Waydroid in your system configuration:

/etc/nixos/configuration.nix
{
  virtualisation.waydroid.enable = true;
}


After rebuilding and switching, finish the Waydroid install in your shell.

Fetch Waydroid images.
You can add the parameters "-s GAPPS -f" to have GApps support.
$ sudo waydroid init

Before the following steps, you might need to do some GPU adjustments. See the troubleshooting section.

Usage

Start the container

Start the Waydroid LXC container
$ sudo systemctl start waydroid-container

You'll know it worked by checking the journal You should see "Started Waydroid Container".
$ sudo journalctl -u waydroid-container

Start Waydroid session
You'll know it is finished when you see the message "Android with user 0 is ready".
$ waydroid session start

General usage

Start Android UI
$ waydroid show-full-ui

List Android apps
$ waydroid app list

Start an Android app
$ waydroid app launch <application name>

Install an Android app
$ waydroid app install </path/to/app.apk>

Enter the LXC shell
$ sudo waydroid shell

Overrides the full-ui width
$ waydroid prop set persist.waydroid.width 608

Maintenance

Update Android

Use following command to upgrade Android (LineageOS) to a newer version if available

$ sudo waydroid upgrade

Resetting Android Container

Warning: All files of your Android container will be lost


Stop Waydroid container
$ sudo systemctl stop waydroid-container

Removing images and user data
$sudo rm -r /var/lib/waydroid/* ~/.local/share/waydroid

Troubleshooting

GPU Adjustments

In case you have an NVIDIA card or an RX 6800 series, you'll need to disable GBM and mesa-drivers:

/var/lib/waydroid/waydroid_base.prop
ro.hardware.gralloc=default
ro.hardware.egl=swiftshader

Linux 5.18+

Linux 5.18 and later removed ashmem in favor of memfd, so you may need to tell Waydroid (1.2.1 and later) to use the new module:

/var/lib/waydroid/waydroid_base.prop
sys.use_memfd=true

Changing keyboard layout

According to an upstream issue, changing the keyboard layout doesn't seem possible at the moment.

Missing UTF-8 support

According to an upstream issue, Android might fail to display special characters correctly.

Waydroid interferes with suspend/hybernation

According to an upstream issue, Waydroid might interfere with suspend or hybernation. You might have to stop the Android session and container to suspend your machine correctly.

Clipboard sharing

Add wl-clipboard to environment.systemPackages.

See Also: