Android on the Raspberry Pi using LineageOS

Learn how to install the Android operating system to the Raspberry Pi by using LineageOS.

Raspberry Pi Android using LineageOS

To get Android to run on a Raspberry Pi, we will be using a special build of LineageOS developed by konstakang.

LineageOS is an open-source operating system that is built upon the Android platform.

While the Raspberry Pi 3 build of Android has support for a hardware renderer, the Pi 4 build currently does not.

This means, for the time being, you may have better performance when using the Pi 3 when you are using anything that is graphics intensive.

The Pi 4 in the meantime, will utilize the Google software renderer called SwiftShader. While its performance is decent, it will suffer most when rendering graphics-intensive games.

You will need to have a Raspberry Pi 4 or a Raspberry Pi 3 to install this version of Android. These builds do not currently support older versions of the Pi.

If you want an alternative way of getting Android to run on your Raspberry Pi you can always try out EmteriaOS.

Equipment List

For this guide on installing Android on your Raspberry Pi, we recommend that you have the following parts.

Recommended

Raspberry Pi

Micro SD Card

Power Supply

Ethernet Cord or WiFi dongle (The Pi 3 and 4 has WiFi inbuilt)

HDMI Cable

USB Drive

Optional

Raspberry Pi Case

We tested our Raspberry Pi Go tutorial on a Raspberry Pi 4 running the latest available version of LineageOS.

Preparing to install Android to your Raspberry Pi

In this section, we will be downloading everything you need to run Android on your Raspberry Pi.

You will learn where to download the LineageOS for the Raspberry Pi as well as the Google Apps.

Downloading Android for the Pi

As mentioned earlier, we will be making use of special versions of LineageOS that have been modified by developer Konstakang to work on the Raspberry Pi.

The developer has provided two versions of the operating system, one for the Raspberry Pi 3 and one for the Raspberry Pi 4.

To respect the developer’s wishes, we have provided links to his official pages to download the Android builds.

Raspberry Pi 4

You can download LineageOS 16.0 (Android 9.0) for the Raspberry Pi 4 by going to the KonstaKANG Pi 4 download page.

Raspberry Pi 3

Likewise, you can find the download page for the Raspberry Pi 3 version of LineageOS 16.0 on the same website.

Like the Raspberry Pi 4 build, this version is built upon Android 9.0.

If you appreciate the work done by the developer on getting Android to run on a Raspberry Pi, consider making a donation through their website.

Downloading Google Apps for Android

As LineageOS does not come with the Google Apps pre-installed, we will need to install them manually.

1. To download Google Apps, we need to go to the OpenGAPPS website.

This website provides packages containing all of the Google Apps that you require to get the Google Play Store running on your Raspberry Pi.

2. On this page, you will need to select a few options to download the correct version of the Google Apps for Android.

Under the platform column, you will need to select the ARM option (1.).

Next, you will need to select the version of Android you are targeting. In our case, this is Android 9.0, so select 9.0 (2.).

The final option allows you to select the version of the Google Apps that you want to download. For our uses, we are going to choose pico (3.).

This variant contains the minimum amount of packages needed to run Google Play.

Finally, you can download the generated package by clicking the download button (4.).

downloading gapps for Android

Once downloaded, copy this file over to a USB and plug it into your Raspberry Pi. We will install the Google Apps later on in this guide.

Flashing Android to your Raspberry Pi

Now that we have both Android and the Google Apps downloaded, we can now proceed with this guide.

In this section, we will be showing you how to flash your newly downloaded LineageOS image to a Raspberry Pi.

To write this image to the SD card, we will be making use of the image writing tool called Etcher. However, you can use other image writing tools.

1. With the Etcher software opened, you need to click the “Select Image” button.

This button will bring up a file dialog box that will allow you to select the Android image that you downloaded earlier.

Select Android Image to write

2. Next, you will need to select the SD Card that you want to write the Android image to. Click the “Select target” button to select your SD Card.

If you only have one writeable device plugged in, the Etcher software will automatically select it.

Select Drive to Write Android To

3. Finally, click the “Flash!” button to begin writing the image to your SD card.

Flash Android to Raspberry Pi

First Boot of Android on your Raspberry Pi

Once you have flashed your LineageOS image to your Raspberry Pi’s SD card, we can begin the process of first booting up your device.

Please note that if you plan on installing the Google Apps, it doesn’t matter as much what you define here as we will need to factory reset our Android installation.

1. When you first boot up LineageOS on your Raspberry Pi, you will be greeted by the following screen.

To begin the initial set up procedure by clicking the “Next >” button in the bottom right corner.

Lineage Initial Setup Steps

2. On the next screen, you will be able to select the language you want to use for your Android device.

You can use the option in the middle of the screen to select the language you want to use (1.).

Once you are happy with the setting, click the “Next >” button (2.).

Select Language for Android on your Raspberry Pi

3. Now let us set the time zone for our device using the dropdown box on the left-hand side of the screen (1.).

You can also use this setting to control the current date and time.

Once you have set your time zone, you can set it by clicking the “Next >” button (2.).

Set Android Time and Date

4. If you are not using an ethernet connection, this next screen will allow you to connect to your Wi-Fi.

Your Raspberry Pi should have already scanned for available Wi-Fi networks, click the network you want to connect to (1.).

Once connected, you can click the “Next” button to continue (2.).

Connect to WiFi within LineageOS

5. This screen allows you to enable or disable the various location services supported by LineageOS.

For simplicity, we left these options as the default and clicked the “Next >” button.

Configure Android Location Services

6. Now you can disable or enable some of the features of LineageOS.

Some of these features include the privacy guard that blocks apps from reading your contacts, messages, or call logs without approval.

Once you are happy with the settings, click the “Next >” button to continue with the setup.

Toggle LineageOS Features

7. This final setup page will allow you to set a PIN, pattern, or password for your Raspberry Pi powered Android device.

Please note that if you plan on installing the Google Apps, it is recommended to skip straight to the next step.

Otherwise, if you want to set a lock screen, click the “SET UP” button (1.).

If you would prefer not to set a password, click the “SKIP >” button (2.).

Protect your tablet Options

8. All you need to do to finalize your Android setup on the Raspberry Pi is click the “START >” button in the bottom right corner.

Initial LineageOS Setup Complete

9. Congratulations, you have now got LineageOS installed and set up on your Raspberry Pi.

Android Successfully running on the Raspberry Pi

In the next section, we will be showing you how you can install the official Google Apps to your device.

Installing the Gapps to your Raspberry Pi

In this section, we will be showing you how to install the Google Apps to your Raspberry Pi running Android.

There are a few different steps required to make this work as you will need to boot into recovery mode to install the Gapps package we downloaded earlier.

Before beginning this section, make sure that you have your USB with the GApps copied to it plugged into the Raspberry Pi.

Enabling Developer Mode on Android

For our first few steps, we will need to enable developer mode on our Android operating system.

Without developer mode, we won’t be able to boot our Raspberry Pi into recovery mode.

1. On the desktop of your Android device, click and drag up from the bottom three apps to bring up the app library.

Drag up to open app library

2. Within this menu, click the “Settings” app.

Open Android Settings App

3. Scroll down to the bottom till you find the “About Tablet” option and click it.

About Tablet Device Page Option

4. Within this settings page, scroll down to the bottom till you see the “Build Number” text.

You need to click this text (1.) until a message pops up notifying you that “You have enabled the development settings!” (2.).

It should only take 5 clicks to enable the settings.

Once done, return back to the settings menu by clicking the back button (3.).

Activating Developer Options

5. Scroll down to the bottom again and open the “System” settings page.

Open Android System Menu

6. To unhide the advanced settings, click the “Advanced” toggle at the bottom of this page.

Enable Advanced System Options

7. Scroll to the bottom till you find the “Developer options” and then click it.

Enter Developer Options Menu

8. There are two different options we will need to configure within this page.

First, scroll down till you see “Root access” and click it.

Enable Android Root Access

9. In the popup, we need to enable root access for both “Apps and ADB“.

Click the corresponding option to proceed.

Enable Root Access for Apps and ADB

10. Finally, you will be warned about the possible implications of enabling root access on your Android device.

As we need root access, click the “OK” button.

Select YES to Allowing Root Access

11. Next, we need to scroll down to the “Local terminal” option and click the toggle.

Enable the Local Terminal App

12. For the local terminal to appear, we will need to restart our Raspberry Pi using the Android interface.

To bring up the power options menu, you will need to press the F5 key on your keyboard.

With the power menu loaded, click the “Restart” button.

Restart Raspberry Pi Android Device

Booting into Recovery Mode

Due to the way the Raspberry Pi works with booting, we can’t get into the Android recovery mode as you do with a phone or tablet.

Instead, we will have to use a special bash script that will rename the partitions so that we can boot in and out of recovery mode.

1. First, we need to get back into the app library on our Android interface.

Again you can do this by dragging up from the bottom of the screen.

Drag up to open app library

2. Within this menu, you need to click the “Terminal” app.

Open Terminal App on Raspberry Pi Android Device

3. When you first open the terminal app, you will be asked to permit it to access files on your device.

To proceed, click the “Allow” button.

Allow Terminal to access Android files

4. Now before we can continue, we need to try and elevate our selves to superuser by typing the following into the terminal.

su

5. As we are asking to be elevated to have superuser privileges, we will see a prompt asking us to enable root access.

Enable root access by clicking the “Allow” button.

Give terminal super user access

6. We can now finally enable the recovery partition for Android on our Raspberry Pi by entering one of the following sets of commands.

These commands differ slightly for the Raspberry Pi 4 and 3, so follow the options for your Raspberry Pi.

Raspberry Pi 4

rpi4-recovery.sh
reboot

Raspberry Pi 3

rpi3-recovery.sh
reboot>

Reboot to Raspberry Pi Android Recovery Mode

Your Raspberry Pi should now reboot into the Android recovery mode provided by LineageOS.

Installing Google Apps in Recovery Mode

Finally, we can now install the Google Apps to our Raspberry Pi powered Android device.

For this section, make sure that you have your USB with the gapps package plugged into your Raspberry Pi.

1. As the recovery mode needs to adjust our system partition, swipe the option in the bottom right corner.

Allow Recovery to Modify System

2. We need to start by mounting our USB storage device.

To get to the mount menu, click the “Mount” button.

Go to Recovery Mount Options

3. Within this menu, make sure that you have the “Boot“, “System“, “Data” and “USB-OTG” partitions selected to be mounted (1.).

Once you have them all selected, click the “Select Storage” button (2.).

Mount USB Device to Android Recovery

4. You will now see a dialog menu asking you to select the storage device you want to use.

Click the “USB-OTG option, as this is where our Google Apps package currently sits (1.).

Once selected, click the “OK” button.

Select USB as Storage Device to access

5. Now return to the Android recovery home page by clicking the home icon at the bottom of the screen.

Return Back to Recovery Main Menu

6. We can now install the GApps package we downloaded earlier on in this guide.

To do that, we need to go into the “Install” menu.

Install packages through recovery menu

7. Within the install menu, click the “open_gapps” package to begin the installation process.

Select Google Apps Zip to write to Android Pi

8. To confirm writing the Google Apps package to your Raspberry Pi powered Android device, you need to swipe to confirm the flashing operation.

The installation process should be completed reasonably quickly.

Swipe to Flash Google Apps

9. Once the Google Apps has finished being written to your Raspberry Pi, click the home button at the bottom of the screen.

Successfull Installation of Google Apps

10. We now need to perform a factory reset of our Android installation.

To perform the reset, we need to click the “Wipe” menu.

Go to Recovery Wipe Menu

11. Within the wipe menu, all we need to do is swipe the toggle in the bottom right corner.

Swiping this option will begin the factory reset process of the Android operating system running on our Raspberry Pi.

Swipe to Factory Reset Raspberry Pi

12. Once the Android recovery software has finished resetting the operating system, we can now go back to the home menu for one final time.

To return to the home menu, click the home icon at the bottom of the screen.

Return to Home After Factory Reset

13. We can now boot back out to the normal Android operating system.

To do this, we need to open up the terminal. To open the terminal within the recovery menu, you need to go to the “Advanced” menu.

Go to Advanced Menu

14. Load the recovery terminal by clickingTerminal” within this menu.

Open Recovery Terminal

15. Now that we are within the terminal app, we can proceed to reboot our Raspberry Pi back to the normal Android operating system.

To get out of recovery, you will need to run the following command.

Please note that these commands differ if you use a Raspberry Pi 3 or a Raspberry Pi 4.

Raspberry Pi 4

rpi4-recovery.sh boot
reboot

Raspberry Pi 3

rpi3-recovery.sh boot
reboot

Switch Raspberry Pi Android Partition to Boot

Setting up your Google Account

As we performed a factory reset, we will need to go back through some initial configuration steps.

These steps include connecting your Google account to your Raspberry Pi Android device.

1. Straight up, you will get a chance to specify the language that you want to use (1.). By default, this is set to English.

Once you are happy with your language settings, click the “START” button to start the setup process.

2. As it is our first time starting up the Raspberry Pi with the Google Apps and Android installed, it will want to check and install updates.

This process can take some time, so please be patient. It will complete after a few minutes.

Updating Google Apps

3. You can now choose whether you want to copy apps and data to your new Android device.

For this tutorial, we will be selecting the “DON’T COPY” option (1.).

However, if you want to copy over data, click the “NEXT” button (2.).

Copy Apps and Data to Raspberry Pi Android Device

4. On this page, you will be asked to connect your Google account.

File in your email or phone number within the text box (1.).

Once you have entered your account details, click the “Next” button (2.) and follow the prompts to login to your account.

Login to Google Account

5. To finalize connecting your Google account to your Android device, you will need to agree to some terms and conditions.

Once you have read through the terms of service, click the “I agree” button.

Agree to terms to add Google Account

6. You can now switch certain Google services on and off.

Once you have configured each service, scroll to the bottom, and click the “ACCEPT” button.

Enable or Disable Google Services

7. On this page, you can configure your device to require a password to be used.

For simplicity, we will be continuing this tutorial by selecting the “Not now” option.

Set a security method for your Pi Android

8. This screen will allow you to adjust the font size or change the wallpaper of your device.

As you can configure these through settings at a later stage, we will just click the “NO THANKS” option to continue.

Extra Android Settings

9. Finally, we can once again configure LineageOS features.

Once you are happy with your settings, click the “Next >” button.

 Set LineageOS Features after GApps install

10. Now, we can return to the Android launcher by clicking the “START >” button.

LineageOS Finished Setup with GApps

11. You should now successfully have Android running on your Raspberry Pi with the Google Apps installed to it.

You will now be able to open up the Google Play store and install apps from it.

Android on Raspberry Pi With Google Apps Installed

Hopefully, at this stage, you will now have successfully got Android up and running on your Raspberry Pi.

Be sure to also check out some of our other Raspberry Pi projects such as our Pi Plex Server.

If you have run into any issues with this guide, post a comment below, and we will try our best to help if we can.

Leave a Reply

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