Android apps on Linux with Waydroid
It is not uncommon for users to want to run a program targeted to one operating system on another type of system. With the increasing prevalence of smartphones, Android has become the world's most widely used operating system. So users may want to run Android apps on Linux systems in order to get access to a game or other app that is not available in a Linux version or to develop mobile apps on their desktop system. The Waydroid project provides a way to run those apps on Linux, which means they can run on a variety of devices, including Linux-based smartphones like the PinePhone.
Waydroid is similar in concept to the Windows compatibility layer Wine. The fact that Android runs on the Linux kernel makes properly running Android apps on other Linux systems much simpler than doing so for Windows software. It is not possible to simply run Android apps directly on a regular Linux operating system, though, because they depend on a different user-space environment. However, by using kernel features such as namespaces, it is possible to run the entire Android user space in a container on a Linux system. This is the technique used by Waydroid; it runs a complete Android system in a container in much the same way that it is possible to, for example, run Debian in a container on Fedora. That allows Waydroid to have better performance than it would have running in a virtual machine or an emulator.
Waydroid runs a custom build of the LineageOS Android distribution. It has all of the software features of LineageOS, though it does not emulate all device features. For example, cameras and telephony features are not supported; WiFi and Bluetooth cannot be configured from within Waydroid either. Networking is supported, however; Waydroid always shows an Ethernet connection, which actually routes traffic through the host. Audio input and output both work using the host's configured audio paths. Other than these and a few other minor differences, Waydroid is mostly similar to a regular Android device without Google apps.
Hardware support
Waydroid supports 32-bit and 64-bit x86 and Arm. 64-bit Arm has the best app support, because it is the architecture used by the vast majority of regular Android devices, but many apps do also work on 64-bit x86. I did not test any 32-bit devices, though. Many apps are written entirely in Java and/or Kotlin, both of which compile to architecture-independent Java virtual machine (JVM) bytecode; these apps work on all architectures without any extra effort from the developer. Other apps include native code compiled from languages like C or C++; these apps must be compiled for each platform, but many developers still build for x86 because most Chromebooks, many of which have x86 processors, also support Android apps.
Intel and AMD GPUs, as well as the GPUs integrated into most Arm SoCs, are supported for hardware graphics acceleration. NVIDIA GPUs are not supported (other than the GPUs in Tegra Arm SoCs), but Waydroid does support software rendering as a workaround.
I tested Waydroid on my PinePhone (64-bit Arm, running DanctNIX with Phosh), two laptops (Dell Inspiron and Lenovo IdeaPad 3, both x86-64 running Arch Linux), and my tablet (Microsoft Surface Go 2, also x86-64 with Arch); all of the devices have touchscreens. I used Wayland on all four, because Waydroid requires it.
Unsurprisingly, the overall experience is best on the phone. The experience with Waydroid on the PinePhone is not much different from using a regular Android phone, other than the limitations of Waydroid that are not present in normal Android devices, such as telephony and the camera not working. Because the PinePhone's hardware is slower than most other Android devices, I disabled user-interface animations. This is an issue with the hardware, however, not with Waydroid. After disabling animations, Waydroid is almost as responsive as an actual Android phone.
Waydroid also works quite well on the laptops. Because most apps are not optimized for use with a keyboard and mouse, I use the laptops' touchscreens much more in Waydroid than I do with regular Linux software. Quite a few apps are designed to support keyboard and mouse input for compatibility with Chromebooks, so those tend to work even better. The experience would be much worse on a desktop or a non-touch laptop, but Chromebook-optimized apps would still work well.
On the tablet, touch gestures did not work properly (a swipe was registered as a long tap at a single point), though they work fine in Linux itself; this made Waydroid almost unusable on the tablet. Because of this problem, I did not do much testing. Surface devices often have problems with Linux, though, so it is likely that this is a device-specific issue (possibly even specific to my software setup) rather than a general problem with Waydroid on tablets.
Waydroid does not work with the default kernel provided by some
distributions because it requires the binder and ashmem
modules. It appears that Ubuntu and Debian both provide these modules by
default, while Fedora and Arch do not. I did not check any other
distributions. On the laptop and tablet, I installed linux-zen,
which is an alternative kernel available for Arch that
does provide the modules. The default kernel used in DanctNIX on the PinePhone provides
them, so I did not have to replace its kernel.
The process for installing and running Waydroid varies depending on the distribution. I followed the instructions on the Arch wiki for the laptops, so I installed waydroid and waydroid-image from the Arch User Repository (AUR) after installing the Zen kernel. After that, Waydroid had to be initialized with "sudo waydroid init" and the waydroid-container service needed to be enabled and started for systemd. The Waydroid documentation has instructions for installing it on other distributions.
Waydroid has two modes, multi-window mode and full user interface (UI) mode. When multi-window mode works properly, Android apps are integrated into the desktop as if they were Linux desktop apps. On all four devices, however, multi-window mode has several bugs that made it difficult to use, so I only use full UI mode. This runs the entire Android UI in a single window.
Waydroid creates .desktop files for every app installed, including the default system apps, and this cannot be disabled. These desktop entries launch the apps in multi-window mode. If you only use full UI mode, however, they just create unnecessary clutter in the menus. The icons can be hidden by adding Hidden=true to the end of each waydroid.*.desktop file in ~/.local/share/applications. Deleting the .desktop files is futile, because Waydroid will simply create them again the next time it is started.
App support
As would be expected, app support is best on the PinePhone, both because it is an Arm device and because most Android apps are primarily designed for phones. On the laptop, most apps are usable, although mouse support is incomplete in many apps; the touchscreen works fine.
One of the most significant differences between Waydroid and a typical Android device is its lack of Google apps. This is certainly beneficial for privacy, but it does have some drawbacks. Many apps cannot be installed or will not work properly without Google apps and services.
The Google Play Store is not available, significantly limiting the number of apps available to install. Many apps that would otherwise work fine in Waydroid, especially proprietary ones, cannot easily be installed because they are only distributed through the Play Store.
F-Droid works well in Waydroid, and does have good mouse support. The vast majority of apps listed with no "anti-features" will work, and many with anti-features also work. The anti-feature most likely to cause problems is "non-free dependencies": often, the non-free software that this anti-feature refers to is Google Play Services. This can cause problems ranging from no push notifications or missing maps to apps that do not even open. Of course, apps that depend on unsupported hardware features will not work properly regardless of whether or not they have any anti-features.
It appears to be possible to make some of these apps work by installing microG, but I did not test this due to concerns that using it may violate the Terms of Service for Google Play. Aurora Store is an alternative Play Store client that most likely works in Waydroid and could be used to install many Play-Store-only apps; I did not test it either for the same reason.
One limitation of Waydroid is that when a link is clicked in an Android app, there is no option to open the link in the host browser without installing additional software. There is an open issue on the Waydroid repository for this, but as a workaround until this feature is added, I wrote a Python script and Android app to add it. The Android app is installed in the Waydroid container and set as the default browser (although it is not really a browser, it is configured to appear in the list of available browsers), while the Python script runs on the host OS. When a link is clicked in an Android app, the "browser" connects to the Python script, which then opens the real browser on the host.
Waydroid development takes place in a GitHub repository. The project's Web site lists three members of the development team, and GitHub currently shows 25 contributors to the main repository. The latest release is v1.2.1, which came out in April, but there has been quite a bit of development since then. Overall, releases have been somewhat sporadic; v1.1.0, the first release listed on GitHub, was published in September 2021, followed by v1.1.1 two days later. The next release, v1.2.0, came out a month after that, then there were no releases between October and April.
Conclusion
Overall, despite some issues and drawbacks, Waydroid is a useful way to run Android apps on Linux, especially on non-Android Linux phones. Like any software, it has some bugs, but most of its problems are caused by the inherent differences between a computer running only or almost only FOSS and a smartphone with large amounts of proprietary software; services considered essential on most Android devices are missing in Waydroid. And, when it is used on a desktop or laptop, the input devices (keyboard and mouse) are fundamentally different from the touchscreens that Android (and most of its apps) are primarily designed for. The Android UI and many apps already have good keyboard and mouse support for compatibility with Chromebooks, but it is still quite evident that Android is primarily designed for smartphones.
Unfortunately, devices without Google Play Services and the Play Store are so rare that there is little incentive for developers to avoid using Play Services or to publish their apps in alternative channels; the primary exceptions are developers of FOSS and/or privacy-focused apps. Of course, some Linux users would not want to use other apps anyway, so this may not be an issue for a lot of Waydroid users.
Even with these limitations, Waydroid significantly expands the range of software available to Linux users, especially those with Linux smartphones. Of course, it is not an ideal solution, just as Wine is not an ideal solution to the shortage of Linux desktop software; it would certainly be better to have more native mobile-Linux apps. Overall, however, Waydroid is quite useful to Linux phone users who do not want to be limited to the few native apps designed for Linux phones. Waydroid is definitely worth trying on any device where one wants to be able to run Android apps.
| Index entries for this article | |
|---|---|
| GuestArticles | Sloniker, Sam |
Posted Jul 19, 2022 17:30 UTC (Tue)
by fratti (guest, #105722)
[Link] (3 responses)
Posted Jul 20, 2022 14:52 UTC (Wed)
by KJ7RRV (subscriber, #153595)
[Link]
Posted Aug 15, 2022 10:49 UTC (Mon)
by Klavs (guest, #10563)
[Link] (1 responses)
Posted Aug 21, 2022 15:06 UTC (Sun)
by KJ7RRV (subscriber, #153595)
[Link]
Posted Jul 20, 2022 3:12 UTC (Wed)
by roc (subscriber, #30627)
[Link] (3 responses)
Posted Jul 20, 2022 7:17 UTC (Wed)
by wujj123456 (guest, #84680)
[Link] (2 responses)
However, the independence ends the moment you try to install any of the Google apps, or western/international apps that use Google Play's API, which are most of them because some of the functionalities are required to use Google's APIs if you want to publish in Google Play. The first thing to do then is still side-loading Google Play services. There is no escape from Google Play if one wants to have the full Android apps ecosystem, similar to the scale offered by Google Play store. For very popular apps, there might be re-packaged version that gets rid of Google Play dependency if it's not critical, but that's generally not reliable.
Posted Jul 20, 2022 14:56 UTC (Wed)
by KJ7RRV (subscriber, #153595)
[Link] (1 responses)
Posted Jul 21, 2022 4:46 UTC (Thu)
by wujj123456 (guest, #84680)
[Link]
Posted Jul 20, 2022 14:14 UTC (Wed)
by epa (subscriber, #39769)
[Link] (4 responses)
Posted Jul 20, 2022 14:57 UTC (Wed)
by KJ7RRV (subscriber, #153595)
[Link] (3 responses)
Posted Jul 20, 2022 18:35 UTC (Wed)
by KJ7RRV (subscriber, #153595)
[Link] (2 responses)
Posted Jul 20, 2022 20:22 UTC (Wed)
by KJ7RRV (subscriber, #153595)
[Link] (1 responses)
Posted Jul 20, 2022 20:33 UTC (Wed)
by epa (subscriber, #39769)
[Link]
Posted Jul 20, 2022 15:30 UTC (Wed)
by mdk (guest, #118072)
[Link] (1 responses)
[1]: https://github.com/streetcomplete/StreetComplete/
Posted Jul 20, 2022 15:50 UTC (Wed)
by KJ7RRV (subscriber, #153595)
[Link]
Posted Jul 21, 2022 1:42 UTC (Thu)
by Conan_Kudo (subscriber, #103240)
[Link] (1 responses)
Posted Jul 24, 2022 18:15 UTC (Sun)
by KJ7RRV (subscriber, #153595)
[Link]
Posted Jul 21, 2022 10:51 UTC (Thu)
by osma (subscriber, #6912)
[Link]
I'm using the Linux-based Sailfish OS on my phone (currently a Sony Xperia XA2, but in the past I had a Jolla C and before that, the original Jolla phone). The official, paid version includes a similar Android compatibility layer called Alien Dalvik, originally developed by Myriad. It's a proprietary solution though. The current version for XA2 can emulate Android 10.
Many of the current limitations mentioned for Waydroid are similar to those of Alien Dalvik. For example, there is no Play Store available; I was able to install it for the older Jolla phones, but with my current XA2, I use Aurora Store and microG. This makes most Android apps available and usually working fine. However, there is no support for Bluetooth (except audio playback), getting GPS working reliably can be a bit tricky, and some apps just refuse to run properly.
I wish the Waydroid project success in its quest to expand the availability of Android apps on alternative platforms.
Posted Jul 28, 2022 3:07 UTC (Thu)
by midol (guest, #25855)
[Link] (2 responses)
Posted Jul 28, 2022 3:26 UTC (Thu)
by mjg59 (subscriber, #23239)
[Link]
Posted Jul 31, 2022 4:38 UTC (Sun)
by KJ7RRV (subscriber, #153595)
[Link]
Funnily enough, this somewhat ties in with a recent article about Android apps on Linux with Waydroid
CONFIG_ANDROID. As I understand it, CONFIG_ANDROID was required to make binder available, which in turn is required for Waydroid to function. Now that that's fixed, I guess I've got one less hurdle in the way of trying out Waydroid. Though unfortunately, most apps I'd like to use it with are proprietary ones that depend on Play services, such as my bank's authentication app. A step in an interesting direction, though!
I'm not sure if Zen Kernel used CONFIG_ANDROID or not. It looks like many distros have the needed modules by default, and it's easy to install them on most others.
Android apps on Linux with Waydroid
Not having Play Services definitely limits app selection. It's unfortunate that Google's ToS (probably) prohibit use of alternative software to access their services.
Android apps on Linux with Waydroid
Android apps on Linux with Waydroid
Android apps on Linux with Waydroid
Android apps on Linux with Waydroid
Android apps on Linux with Waydroid
Android apps on Linux with Waydroid
Does it work on Windows?
Does it work on Windows?
I'm testing it in WSL 2 on Win11 on the IdeaPad. Right now I'm recompiling the kernel, because apparently that's the only way to get binder and ashmem in WSL 2. I'm using a script (install-dkms-only.sh) designed for installing Anbox (Waydroid's predecessor; they both need the same kernel modules) on WSL 2, with one change to the git clone command. Microsoft apparently renamed branches in their WSL 2 kernel repo, and you only need the latest code, so I replaced git clone --branch "$KERNEL_VERSION" --depth=30 https://github.com/microsoft/WSL2-Linux-Kernel "$KERNEL_SRC_DIR" with git clone --depth=1 https://github.com/microsoft/WSL2-Linux-Kernel "$KERNEL_SRC_DIR". It's compiling the kernel right now. Hopefully it will work.
Does it work on Windows?
Does it work on Windows?
Does it work on Windows?
Android apps on Linux with Waydroid
[2]: https://github.com/waydroid/waydroid/issues/226
I noticed that too. I tried to use c:geo, an open source Geocaching.com client, and lack of GPS support was one of the major problems. I could search for geocaches, but geocaching without GPS doesn't really work.
Android apps on Linux with Waydroid
A small correction: Fedora Linux has shipped Android apps on Linux with Waydroid
binder since it shipped Linux kernel 5.15. It does not ship ashmem as it is not required for Android anymore. But CONFIG_ANDROID is required for enabling binder.
Android apps on Linux with Waydroid
Android apps on Linux with Waydroid
Android apps on Linux with Waydroid
Android apps on Linux with Waydroid
Android apps on Linux with Waydroid
