How to Install Android 9 on Raspberry Pi 4

How To Install Android 9 On Raspberry Pi 4

Raspberry Pi gives you the freedom to install a huge range of operating systems, including some niche operating systems! While systems that were designed for Raspberry Pi tend to provide a more reliable user experience, there may be a time when you need a very specific feature set, like accessing Android apps.

In this article you’ll learn how to bring touchscreen support by installing Android 9.0 on Raspberry Pi 4. While the user experience can sometimes feel awkward and laggy, you’ll have multi-touch and touchscreen support, access to a huge variety of Android apps, and the bragging rights that you managed to get Android up and running on Raspberry Pi!

What you’ll need

To complete this tutorial, you’ll need:

  • A Raspberry Pi 4
  • An SD card
  • A laptop or computer where you’ll download the Android 9.0 system image
  • A power cable that’s compatible with your Raspberry Pi
  • A micro HDMI cable
  • An external monitor, or, if you want that authentic Android experience, a screen that has touchscreen support
  • An external keyboard and a way to attach this keyboard to your Raspberry Pi
  • A mouse or the trackpad on your external keyboard
  • Optionally, an ethernet cable

Once you’ve assembled your tools, you’re ready to get Android 9.0 running on Raspberry Pi!

Downloading LineageOS 16.0

We’re using a build of LineageOS 16.0 as the base Android 9.0 image. Do note that this build is unofficial and unsupported by the LineageOS team, and it typically isn’t suitable for performing intensive tasks, such as playing games or streaming high-resolution media. 

We’re flashing this system image to our SD card using the free Etcher application, so if you don’t already have this set up on your computer or laptop, then head over to the balenaEtcher website and download the latest version

  • Head over to the KonstaKANG website and download LineageOS 16.0
  • Insert the SD card into your laptop or computer. 
  • Launch the Etcher application.
  • In Etcher, click “Select image” and then choose the LineageOS file you just downloaded.
  • Click “Select target” and choose your target boot medium, which in this instance is the SD card.

Etcher will now flash the system image to the SD card. 

Running Android on Raspberry Pi

You’re now ready to get your first taste of Android running on the Raspberry Pi!

  1. Remove the SD card from the laptop or computer and insert it into the Raspberry Pi.
  2. Attach the monitor to the Raspberry Pi using the micro HDMI cable.
  3. Attach the keyboard to the Raspberry Pi device.
  4. Attach an ethernet cable to the Raspberry Pi. 
  5. Plug the Raspberry Pi into a power source. The device should now boot automatically.
  6. After a few minutes you’ll see the “Lineage” welcome screen. Click “Next.” 
After a few minutes, you'll see the Lineage operating system logo.
  1. You’ll now be prompted to complete the usual setup, such as choosing a language, setting the time and date, and connecting to a Wi-Fi network.  
  2. Once you’ve entered all this information, click “Start.”

You’ll now be taken to the main Android screen.

You'll now be taken to the main Android homescreen.

Don’t forget about Google Play!

Android should now be up and running, but LineageOS doesn’t come with Google Play installed. To get Google Play, download and install GApps, which includes Google Play and all the services required to power this application. The Device ID APK is needed as well, which will be used to generate a code that identifies the device and allows us to connect to Google Play. 

  • Launch the web browser that comes pre-installed on Android and head to the GApps website.
  • Select “ARM,” “Android 9” and “Pico,” and then click the “Download” icon.
Download the GApps package to your Raspberry Pi.

Moving the GApps file

To make the next steps easier, drag the GApps file to the root of your storage:

  1. Drag upwards from the bottom of the screen to open the app drawer.
Drag from the bottom of the screen to open the Android app drawer.
  1. Find the “Files” application and give it a click.
  2. Select “Downloads.”
  3. Find the “GApps” file that was just downloaded and drag it towards the menu on the left. Release “GApps” over “Raspberry Pi 4.”
Find the GApps package and drag it onto "Raspberry Pi 4" in the left-hand menu.

This file will now be easier to find when we boot into Recovery mode. 

Unlock Android’s hidden Developer Options

Developer Options need to be enabled, which will give you access to the Terminal: 

  1. Drag upwards from the bottom of the screen to open the application drawer.
  2. Select the “Settings” application.
  3. Open “About tablet.”
Scroll to the bottom of the screen, and select 'About tablet."
  1. Find the “Build Number” section and click it repeatedly until you see a “You have now enabled developer settings” pop-up.
Keep clicking the "Build Number" until you see a popup.
  1. Navigate back to the main “Settings” screen, but this time navigate to “System -> Advanced -> Developer Options.”
  2. Tap “Root access.” In the subsequent pop-up, ensure “Apps and ADB” is selected. 
Enter commands into the Android Recovery Mode Terminal.
  1. When prompted to allow root access, click “OK.”
  2. Next, scroll to the bottom of the “Developer Options” screen, find “Local Terminal” and drag its accompanying slider to the “On” position. 

You can now exit the “Settings” application.

Raspberry Pi needs to be rebooted in order to gain access to the Terminal, so press the F5 key on the keyboard, which will open a “Power” menu where you can select “Restart.”

Boot into Android’s Recovery Mode

To boot into Recovery Mode:

1. Open the app drawer by dragging upwards from the bottom of the screen.

2. Select “Terminal.”

3. Type the following command into the Terminal window:


4. Press the “Enter” key on your keyboard. When prompted, select “Remember my choice” followed by “Allow.”

5. Type the following command into the Terminal:

Press the Enter key and run the following command: 


Press Enter.

Terminal Android Recovery Mode

Android will now reboot into Recovery Mode. 

Install GApps and wipe the Dalvik cache

To install GApps:

1. In Recovery mode, find the “Swipe to allow modifications” slider and drag it to the “On” position. 

Drag the "Swipe to All Modifications" slider.

2. Select “Install” and find the GApps package you downloaded earlier.

3. Give GApps a tap, then drag the “Swipe to confirm Flash” slider. GApps will now be installed.

4. Wipe the Dalvik cache by dragging the “Swipe to wipe” slider. 

5. When you see the “Dalvik wipe complete” screen, click the “Back” button.

6. In the upper-left corner, select the “Team Win Recovery Project” icon, which will take you back to the main menu.

7. Click “Wipe.”

8. Drag the “Swipe to Factory Reset” slider.

9. When prompted, click “Back.” In the upper-left corner, select the “Team Win Recovery” button which will once again take you back to the main menu. 

10. Click “Mount.”

11. Make sure “Boot,” “System” and “Data” are all selected, then return to the main screen by clicking the “Team Win Recovery Project” icon.

Make sure "Boot," "System" and "Data" are all selected.

12. Click “Advanced -> Terminal.”

13. To reboot the system from Terminal, type: boot

Press the Enter key on your keyboard.

14. Type the following command into the Terminal:


Press Enter. The system will now reboot.

Once Android has booted, you may need to perform some extra configuration: for example, agreeing to the Google Terms and Conditions and setting up a protective PIN. Once you’ve completed this setup, there should be a new addition to your homescreen: Google Play is now installed on your device!

However, there’s a catch: if you try to launch the Google Play application, then you’ll encounter a warning that your device isn’t Play Protect-certified. The final task is to generate a code using the Device ID APK, then using this code to authenticate the device. 

Get Play Protected: Registering with Google

To generate the Device ID code: 

  • Open the app drawer by dragging from the bottom of the screen, then selecting “Files.”
  • Navigate to the “Downloads” folder. 
  • Find the Device ID APK that you downloaded earlier and double-click to launch. When prompted, select “Install.” 
  • Open the app drawer and select the newly-installed Device ID application.
  • Once the app has launched, click “Google Service Framework.” A code will appear in a pop-up. Click “Copy.” 
  • Towards the top of the screen, you should see a “Device is not Play Protect certified” warning. Click this to launch a popup. 
  • In the pop-up, scroll to the “Custom ROM users” section and click the accompanying link. This will launch Android’s default web browser.
  • When prompted, log into your Gmail account.
  • Once you’re logged in, paste the code from the Device ID APK and paste it into the “Register” field.
  • Select “Register.” Google will now register this device as a custom ROM and allow you to access Google Play.

Your changes only become active following a reboot, so use the F5 key to reboot the system.

When your Raspberry Pi has performed its reboot, launch the Google Play app, sign in with your Gmail account, and you’re ready to start downloading Android apps to the Raspberry Pi 4! 

If you receive an error message when trying to access Google Play for the first time, then try waiting for around 15 minutes, as there can sometimes be a delay before Google successfully registers your ID.

Although Android 9.0 wasn’t designed for Raspberry Pi, it offers a unique combination of touchscreen support and access to an entire ecosystem of Android apps. Other than that, there are also many other ways to put the Raspberry Pi 4 to good use.

Jessica Thornsby
Jessica Thornsby

Jessica Thornsby is a technical writer based in Derbyshire, UK. When she isn’t obsessing over all things tech, she enjoys researching her family tree, and spending far too much time with her house rabbits.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox