How to run the willhaben Android app on a Raspberry Pi

Bernd Wolfram
willhaben Tech Blog
8 min readJun 14, 2022

--

Photo by Jeff Loucks on Unsplash

Some months ago, here on the willhaben tech blog, a contest among our engineers was announced: ‘Propose a blog post topic, and the topic with the most votes from our readers will win a small prize’.

To motivate readers to vote for a blog post, a raffle was also proposed, and some participants received willhaben goodie bags (with a Raspberry Pi inside). So a few lucky winners are likely sitting at home with a Raspberry Pi in their hands, wondering what projects to realise with it and how to impress their colleagues 😉. We will cover a more exotic choice in this blog post — how to install the Android OS and, then, the willhaben app.

What do I need?

As part of your goodie pack, you received a Raspberry Pi 3 model B. To install Android on it, we will use an unofficial LineageOS build created by konstakang.

LineageOS is an open-source Android distribution for smartphones and tablets. It is the successor of CyanogenMod, and its main purpose is to allow newer OS versions to be installed than are supported by the device manufacturer.

On the Pi 3, we can install LineageOS 17.1, which is Android 10. Many useful tips and a FAQ section can be found here. To install the willhaben app, we will use Google Play Store, which we can retrieve through Open GApps.

What hardware do I need?

  • Raspberry Pi, e.g. model 3B
  • micro SD card, e.g. 32 GB
  • power adapter + micro USB cable
  • monitor + HDMI cable
  • keyboard
  • mouse

What software do I need?

  • LineageOS build, found here
  • Open GApps (Platform: ARM, Android: 10.0, Variant: Pico)

And last but not least, you’ll need patience 😉. Especially after installing the necessary Google apps, the system becomes quite slow (likely due to the 1 GB RAM).

Writing the OS to the micro SD card

After downloading LineageOS, we can write it to the SD card. One way to achieve this is by using Raspberry Pi Imager, which we first need to install on a separate PC. Then we can select the downloaded LineageOS image file, click on the micro SD card we want to write it to and hit the ‘Write’ button.

Raspberry Pi Imager
Raspberry Pi Imager — write image

Further information on how to use the Raspberry Pi Imager can be found here.

Starting Android for the first time

To boot Android on our Raspberry Pi for the first time, all we need to do is connect the hardware properly, insert the micro SD card and connect it to the power adapter. Booting for the first time will take longer than usual, but after a few minutes, the animation should stop, and we should see the following setup wizard:

LineageOS setup wizard

After clicking ‘Next’, we will have to accept the End User License Agreement. Afterwards, we can choose our preferred language settings. The next screens will allow us to choose the date and time, configure permissions for apps to use location services and set up a device pin, pattern or password, among other things. After finishing the setup process, we end up on the home screen:

LineageOS home screen

Now, it’s time to get familiar with our installed Android. In addition to the usual Android 10 and LineageOS features, we can also use the keyboard to compensate for missing touchscreens and buttons. The following keyboard keys work as Android buttons (as mentioned here):

F1 = Home, F2 = Back, F3 = Multi-tasking, F4 = Menu, F5 = Power, F11 = Volume down, and F12 = Volume up (=> Screenshot: F5 + F11).

Download and install Google Apps

To install Google apps, such as the Google Play Store, we can use a prebuilt Google Apps package generated by the Open GApps project. We need to open this link in the browser that is part of this LineageOS build.

Open GApps download page

We will choose ARM as the platform, Android 10.0 and pico as the variant. The pico variant is described as ‘the bare minimum to get Google Play functionality’, which is exactly what we want as the hardware resources of the Raspberry Pi 3 model B are limited and we don’t want to risk worse performance by installing more software than necessary. After clicking the red circular download button, we will be forwarded to a sourceforge.net page where we can download the image.

Enable developer settings

For our next steps, we need to adapt the device’s developer settings. To enable developer options, we navigate to the Settings → About tablet, and click the build number several times. A toast will pop up, showing us how many clicks are needed.

Enabling development settings

Now we can turn on the ‘Advanced restart’ setting, which allows us rebooting to recovery and install the Google apps. We can find this configuration in Settings → System → Developer options → Advanced restart.

Advanced restart setting

Improve performance

Since we already have the settings open, we can make a few more helpful tweaks. After installing the Google Apps package, the OS will become less responsive. Therefore, we will make a small change in the developer options as explained here (tip 15): we will turn off window and transition animations.

We can search in the developer options for ‘animation’ and turn off the following three settings by choosing the ‘Animation off’ option:

  • Window animation scale
  • Transition animation scale
  • Animator duration scale
Animation settings
Turn off animation

Booting into recovery to install Google Apps

Now that we have enabled the ‘Advanced restart’ setting, we can reboot into recovery by long-clicking F5 → Restart → Recovery.

What is a recovery?

As explained here, a recovery refers to a dedicated partition with a recovery console installed. The recovery as supplied by the manufacturer usually provides a few tools to help you repair/recover your installation. The Team Win Recovery Project (TWRP) offers an open source custom recovery with greater functionality. With the LineageOS build we are using, we’re in luck because TWRP is already included. (Usually when installing LineageOS on a smartphone, we would need to perform extra steps, such as unlocking the bootloader, before we could eventually flash the recovery. More information about the process can be found here.)

TWRP home screen

After booting into the recovery, we will be asked if we want to allow modifications, which we will confirm.

As we have already downloaded the Open GApps image, we can then click ‘Install’ and choose the image from the download folder.

Dialog to select the file to install

We can click the checkbox to reboot after installation and then move the ‘Swipe to confirm flash’ widget to the right.

Confirm flashing the file

Afterwards, LineageOS will be booted again.

Optionally adapt play protect settings

At this point, our Android installation may become quite slow. One way to speed things up again is to deactivate the ‘Scan apps with Play Protect’ setting.

Play Protect Settings

Installing the willhaben app

Now the Google Apps package is installed, we can use the Play Store to install the willhaben app.

Sign-in with your Google Play account

First, we need to sign in with a Google account. Then, we can search for the willhaben app and install it.

Install the willhaben app

Running the willhaben app

When running the willhaben app now, we see that it looks the same as on a tablet.

Willhaben onboarding dialog
Search entry screen
Search result list
Screen to insert an ad

Summary

In this blog post, we covered the process of getting an Android app running on a Raspberry Pi. The device may seem like an outlandish choice, but there are similarities between a Raspberry Pi and a smartphone. For instance, both mostly use ARM architecture. Still, the Raspberry Pi is not intended to run Android. The hardware itself is typically some years behind current smartphones. Booting the operating system from a micro SD card also takes a toll on the Raspberry Pi’s performance. The biggest bottleneck we experienced was likely the 1 GB RAM, which is also shared with the GPU.

In light of that, the LineageOS build we used offered us an easy way to run Android on a Raspberry Pi and achieve good performance, especially before installing the Open GApps package. For even better performance, you could use a Raspberry Pi 4, for which even Android 12 is supported. That should do the trick of impressing your colleagues. If it doesn’t, maybe it’s time to see if you are a good fit for one of our teams at willhaben 😉.

Links

https://tech.willhaben.at/what-you-always-wanted-to-know-about-willhaben-faa2159844d7

https://www.raspberrypi.com/products/raspberry-pi-3-model-b/

https://lineageos.org/

https://en.wikipedia.org/wiki/LineageOS

https://konstakang.com/devices/rpi3/LineageOS17.1/

https://opengapps.org/?api=10.0&variant=pico

https://www.raspberrypi.com/documentation/computers/getting-started.html#using-raspberry-pi-imager

https://github.com/opengapps/opengapps/wiki/Pico-Package

https://fossbytes.com/make-android-faster-tips-tricks/amp/

(Tipp 15: Make Android Faster With Developer Options)

https://www.androidcentral.com/what-recovery-android-z

https://twrp.me/about/

https://www.androidauthority.com/lineageos-install-guide-893303/

https://konstakang.com/devices/rpi4/

https://jobsbei.willhaben.at/

--

--