How to Install Android on Raspberry Pi 4? (with Play Store)


Installing Android on Raspberry Pi is a dream that is difficult to achieve. Perhaps you already tried it unsuccessfully? Me too, many times πŸ™‚
I already made a tutorial on this topic by using Emteria and a Raspberry Pi 3 (link here). But Emteria is a paid software, and the whole system was a bit slow and unstable on Pi 3
How does it work now with a better Raspberry Pi and OS? We’ll see this today in this post

How to Install Android on Raspberry Pi 4?
Installing Android on Raspberry Pi become easier each day, but it’s still not as simple as with other operating systems
The core system is easy to install, but then you need to do several steps to enable all the services and install Google Play Store

In this tutorial, I will guide you through all these steps with LineageOS, a good alternative to run Android on Raspberry Pi 4

What is LineageOS?

Introduction

LineageOS is a free and open source operating system, as often when I introduce a new system on this website
The first thing to understand is that LineageOS is made for smartphone and tablet, it’s not an emulator or something specially dedicated to single board computers

LineageOS was created in 2016, and is a fork from CyanogenMod
LineageOS comes with a few basic applications (browser, calendar, calculator, etc.), but no Google applications or useless preinstalled software
If you are interested, you can get more information on their website

Does it work on Raspberry Pi?

As you can imagine, I will not write here on something that doesn’t work on Raspberry Pi πŸ™‚
So yes, there is a way to make it work on your Pi, but it’s not with the official release

As you can see on the download page here, LineageOS is available for many devices (Samsung, Huawei, Sony, etc.) but not for anything other than smartphones and tablets.

But there is an unofficial version available on this website for Raspberry Pi 4
It’s not the latest LineageOS version (it’s Android 9 – Pie), but it’s pretty good for the moment
So, I’ll show you how to install this version on your Raspberry Pi 4
There is also a version available for Raspberry Pi 3 if you use this model.

A good idea can be to use it with the official touch screen for Raspberry Pi.
This way you can get a real Android tablet for cheap.

Android installation

Prerequisites

Ok, so you’ll need to download several things before starting the installation process
As it’s not always easy to download it directly from the Raspberry Pi, I recommend downloading it from your computer
I will explain what to do with each file later

So, download all these files on your computer :

  • Balena Etcher
    We’ll use it to flash the SD card. It’s available on any operating system
    You may already have it or prefer another tool, no problem
  • LineageOS for Raspberry Pi 4
    or LineageOS for Raspberry Pi 3
    You can check if there is a more recent version available, but I’m doing this tutorial with this one
  • OpenGapps
    The alternative to install Google Apps on a custom Android device
    Choose the ARM platform, Android 9.0 and the “pico” variant

I recommend copying the “OpenGapps” file to a USB key
It’s easier than downloading it from the Android system
I’ll show you in the last part how to install them

Flash the SD card

Next, we need to prepare the SD card
As usual on this website, I’m using Etcher to do this :

  • Install Etcher if not already done
  • Start it, you’ll get something like this :
    etcher menu
  • On the left, pick the LineageOS image file from your Downloads directory
    The insert your SD card in your computer, Etcher should select it automatically
    And finally click on “Flash!” to start the copy

A few minutes later, your SD is ready and you can insert it in your Raspberry Pi

First boot

Start your Raspberry Pi
The first boot is a bit longer, probably to configure everything
Once done, you get a first wizard to finish the setup

Choose your language, time zone and wireless connection
Then you can configure the other options as you want (privacy, security, etc.)

Once done, the Android desktop shows up
Depending on your goal, you already have something working with basic apps (browser, file browse, etc.)
To access them, scroll up the bottom bar

But you’re probably not here to use only the email and browser apps, so let’s move to the Google Apps installation

Free Download!

Compact list of 20 operating systems available on Raspberry Pi, with direct links to websites, downloads and tutorials

Install Google Play Store

This is always the most complex part on an Android installation, whatever the device or system
As we don’t use an official Android image and device, there are additional steps to enable Google Play Store

Enable Developer options

We’ll need to go in recovery mode to install additional packages
To do this, we need to enable developer options and run a command as root

Let’s do this :

  • Go into the Settings
  • Go at the end of the list (with the keyboard arrows) and find “About Tablet”, click on it
  • Then find “Build number” and click several times on it
    After 5 times maybe, a message appears to say that you enabled the developer options, it’s fine
  • You can now come back to Settings and open the “System” menu
    In the “Advanced” part, there are the developer options
  • From here, there are two things to enable :
    • Local terminal
      We’ll need to use a command to reboot in recovery mode
    • Root access, we need it to run the command
      Choose “Apps and ADB” in the list
  • Reboot the Raspberry Pi
    Press and hold F5, and click on “Restart”

Ok, you are ready to move to the next part
We need to go in recovery mode

Reboot in recovery mode

Back in Android, you should see a Terminal app available

Open it and enter the following commands :
su
rpi4-recovery.sh
reboot

Allow all asked permissions
If you are on Raspberry Pi 3, there is probably an equivalent, something like rpi3-recovery.sh

The system will now reboot on recovery mode
Swipe to allow system modifications, you should get this screen :

We can now move to the Google Apps installation

Install Google Apps

Once in recovery mode, plug your USB key with Google Apps on it
Then follow this procedure :

  • Click on “Mount”
    This is where you can choose which partition to mount
    We need to mount the USB key, so check it in the list (USB-OTG in my case, I don’t know if it’s my USB key model or always this)
  • Then, back to the main menu, click on “Install”
  • Click on “Select Storage” and choose the USB key
  • Finally, your files appears
    Click on the Open Gapps file to install it

    Swipe to confirm, there is nothing else to change
  • Don’t reboot after the installation as it will come back to the recovery mode

If everything is OK, you can now restart in normal mode, check the next part

Reboot in normal mode

As to enable the recovery mode, we also need to run the command to change the boot to normal mode

  • From the recovery mode menu, go again into “Mount”
    Check that the boot partition is checked, or do it if it’s not the case
  • Then go to Advanced and Terminal
  • Enter almost the same commands:
    rpi4-recovery.sh boot
    reboot

Note: From Android 10 and over, the rpi4-recovery.sh script is no longer available in the terminal, you need to download this file from Konstagang.
Put it on the same USB key with Gapps, and install it just after Gapps.
It will reboot in normal mode.

That’s it, your Raspberry Pi will now restart in normal mode
Once on the Android desktop, you can see that Play Store is available in the apps

Sign in on Play Store

The last step is to sign in on Google Play, as for any Android device
Open the Play Store app and try to sign in with your Google account


You may get some error messages during this process, asking if you want to close or wait



Keep choosing “Wait” until you manage to log in

Once logged in, you can close the app and reboot the device
After the reboot, everything should be fine
You can now install any app or game you want on your Raspberry Pi πŸ™‚

Video

I have recorded the process in video simultaneously. You can watch it here if you want :

Check the RaspberryTips YouTube channel to receive new videos in your feed :

Recommended stuff for Android

  • Raspberry Pi 4 : If you don’t have one yet, I absolutely recommend switching to the fastest Raspberry Pi model available. Android is still a bit slow on any other model.
  • SSD drive: If you expect more performances, a Raspberry Pi and a SSD allows you to run systems really fast. My favorite model is this one, and you SSD drives are now really affordable, go for it! (USB adapter included)
  • Touch screen : Android is built to use on a tactile screen, this one is cheap and allow you to have a better experience with your new Android system.

Conclusion

That’s, we finally found a way to have Android working better than ever on Raspberry Pi
And it’s not so difficult to install, we don’t need any account (except from Google), and it’s free πŸ™‚

I didn’t play with it too much after that, so if you have any other opinion or issue, let me know in the comments below

Patrick Fromaget

I'm the lead author and owner of RaspberryTips.com. My goal is to help you with your Raspberry Pi problems using detailed guides and tutorials. In real life, I'm a Linux system administrator with a web developer experience.

14 thoughts on “How to Install Android on Raspberry Pi 4? (with Play Store)

  1. I really like how well you laid out the instructions. I was going along just fine until I hit one of those “you can’t fix stupid” situations. Stupid, of course meaning me. I cannot determine how to configure the “USB key with Google Apps on it”. I feel that it needs a boot partition. Oh heck, rather rambling along, please detail if time avails. I’m really liking the install.

    Thanks for any assistance.
    Mr. Lost-In-The-Dark

  2. can i run this version of LineageOS in Pi 4B, on two different monitors showing two different apps? dual monitor supports exists in Pi 4B, will Lineage OS support that also?

  3. Thank you very much for your detailed tutorial,
    I was able to setup a raspberry pi 4B (4GByte RAM) with an industrial touchscreen monitor,
    used as HMI in kioskmode (showing a webinterface)!
    Thank you very very much for your nice work!

    One usecase works on my solution based on “Raspbian Buster Desktop”, chromium in kioskmode and chromium-extension “Virtual Keyboard”. But this didn’t work with our second usecase (also a webinterface), where the on-screeen-keyboard didn’t show up…

    Some details I had to handle:
    -edit “config.txt” with SD-card-reader on bootpartition for getting screen output on my PC-HDMI-monitor, as close as possible to our used screen resolution of 1920×1080:
    hdmi_group=2
    hdmi_mode=85 (it’s only 1280×720, also 16:9, so scaling our webinterface works well)

    -reboot of Android / LineageOS: long press on “F5”

    -showing all installed apps: gesture from down into screen over Android-circle

    -“Reboot in normal mode”
    in “Mount” I had to select “Boot” AND “System”,
    otherwise “rpi4-recovery.sh” wasn’t found

    -additional apps via Playstore:
    -TeamViewer Host (only screen sharing is possible, there’s no addon for remote control…)
    -Fully Kiosk Browser
    (autostart with Android/LineageOS works well)

    =>background image had a weird problem, setting fullscreen picture in LineageOS doesn’t work, it seems that it has problems with screen width/height. App “Image 2 Wallpaper” helped to scale and setup the image, but I couldn’t manage to center it… But that’s peanuts. πŸ˜‰

    1. Some tests further showed three showstoppers (ordered by priority):

      1) configuration of static IP address on ethernet port
      It’s not available on Android user interface, and it seems that it’s a widespread problem…
      Has anyone found a simple and persistent solution?

      2) screen resolution
      Website-scaling in “Fully Kiosk Browser” works well, but after userinputs with on-screen-keyboard the user has to manually zoom out (nativ resolution of our webinterface is 1920×1080). It would be very cool, if Android on Raspberry Pi 4B could provide full-HD resolution…

      3) remote access to Android
      TeamViewer Host is accessible as on other Android-based tablets, but only screen mirroring works. There’s no TeamViewer-Addon for sending mouse or keyboard events.

      Well, perhaps one day there will be a solution. πŸ™‚

      @Patrick: Thank you for your good documentation.

    1. Hi,
      I think it should work directly
      There is a comment on the YouTube channel about this, maybe you can ask the author if you have any problem:
      https://www.youtube.com/watch?v=bcE3hL4-Pk8

  4. Dam its works in the beginning but is really slow when i tried to fix it it never loaded do u think u could do another tutorial on how to run it faster

  5. Hi,

    I just updated this post as many people on YouTube told me that they were unable to reboot in normal mode after the Gapps installation.

    If you are trying this tutorial with Android 10, there is a small change at the end:

    Note: From Android 10 and over, the rpi4-recovery.sh script is no longer available in the terminal, you need to download this file from Konstagang.
    Put it on the same USB key with Gapps, and install it just after Gapps.
    It will reboot in normal mode.

  6. Thx for this article.

    I have a question: if you install LineageOS on the Raspi 4 is it then a normal Android (smarthpone) without a touch-screen?
    Or can it work 100% as a Android TV, where no touch screen is working?

    I just bought a chinese Android TV Box (xgody T95) – and it says it’s a phone.
    So all the app are thinking, they are on a smartphone and not on a TV .

    I want to avoid the same with the raspberry pi.
    can you tell me, how it reacts (without a touch screen?)

    1. Sorry, I don’t really know the difference
      You can ask on the LineageOS website, or maybe the fastest is to test πŸ™‚

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Content