Learn how to Install Android TV to the Raspberry Pi

This project will show you how you can install Android TV onto the Raspberry Pi.

Android TV is a special version of the popular mobile operating system. It features a redesigned interface that works better with the horizontal nature of TV screens.

To get Android TV to run on a Raspberry Pi, we will be using a special build of LineageOS. This build is maintained and developed by the hard work of KonstaKANG and the Android-rpi team.

With the OS being more optimized for large horizontal screens and remotes, it makes it the perfect choice when connecting the Pi to your TV. You can even get access to the vast amount of available apps through the Google Play store.

Currently, the most significant issue facing running Android TV on a Raspberry Pi is that the builds do not have support for hardware video decoding and encoding.

However, the Android TV builds do feature hardware-accelerated graphics. This means it should be possible to run most apps as long as they don’t rely on video decoding.

Please note that at the time of publishing, builds are only available for Raspberry Pi 4 based models. Meaning you can only run Android TV on the Pi 4 Model B, Pi 400, and the Compute Module 4.

Throughout this guide, you will learn how to install Android TV, configure it and install the Google Apps package.

If you would prefer to stick with the normal version of Android we also have a guide on installing that. (https://pimylifeup.com/raspberry-pi-android-lineageos/)

Preparing for Android TV on the Raspberry Pi
Installing Android TV requires us to download a particular version of LineageOS built by KonstaKang.

We will also need to download the Google Apps package. Without this package, you won’t have access to the Google Play Store on your Raspberry Pi Android TV.

Obtaining Android TV for the Raspberry Pi
Our first step is one of the most important, and that is to download the Android TV image.

We need to download a version of Android TV that has been specially compiled to run on the Raspberry Pi’s hardware.

At the time of publishing, there are only builds available for the Pi 4 generation of devices.

You can download the required Android TV build for the Raspberry Pi by going to the KonstaKANG website.



If you like the developers work, consider donating through their website to help contribute to the development of Android TV for the Pi.

Downloading GApps for Android TV
Google does not allow other Android operating systems to bundle their apps without licensing the software from them.

Luckily we can work around this thanks to the OpenGApps project. Using the packages provided by this team, we can install Google Apps to our Raspberry Pi’s Android TV operating system.

As these builds are automated, they may get broken by a bad update from time to time.

1. You can download the last build we have personally tested directly from the OpenGapps SourceForge page. This build was compiled on 26/06/2021 and worked on our Raspberry Pi 4.

If you download the build through the link we provided above you can skip straight to Step 4 of this section.


Alternatively, you can follow the steps below to get the latest build of the OpenGapps recommended by their official website.

2. To get the Google Apps onto your Raspberry Pi, you will need to go to the OpenGapps website.

This website, provides all of the apps we need to get the Google services up and running on our Android TV OS.

3. Once you are on the website, you will need to select a few options to ensure you download the correct version of Google Apps.

1) For the platform option, you will need to select “ARM” (1.).

This is the architecture that Android TV for the Raspberry Pi is compiled for.

2) Next, you will need to select the version of Android you are using. The build of Android TV we are currently using is made for Android 10.0.

Select the “10.0” option (2.).

3) For our next option, we must select the variant of Google Apps built for Android TV.


You need to select the “tvstock” option (3.).

4) Finally, we can download the GApps package for our selection by clicking the download button (4.)

Downloading GApps for Android TV

4. Once you have downloaded the GApps package for your Raspberry Pi’s Android TV installation, you need to copy these to a USB.

Once you have the archive copied to a USB drive, you can plug the drive into your Raspberry Pi. We will use these files after we have installed Android TV.

Writing the Android TV Image to your Raspberry Pi
Now that we have everything we need to run Android TV on our Raspberry Pi, you can now continue with our setup guide.

In our next few steps, we will show you how you can flash the Android TV operating system to your device.

To write the Android TV image to our Raspberry Pi, we will be using the Etcher image writer. However, you can use whatever one you feel comfortable with.

1. When you first open up the Etcher software, click the “Flash from file” button.


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

Etcher Flash Raspberry Pi from File
2. With an image selected, our next step is to select the drive we want to write it to.

At this point, you should have your SD card plugged into your computer.


You need to click the “Select target” button to proceed with the flashing process.

Etcher Select Drive to write Android TV
3. Using this menu, you need to identify and select the drive you want to write the image to (1.).

Once you have your SD Card selected, you need to click the “Select” button (2.).


Etcher Choose Target Drive for Android TV Image

4. Finally, with both the drive and image selected, we can start the flashing process.

All you need to do to start the process is click the “Flash!” button.

Flash Android TV to Raspberry Pi SD Card

5. Once the Android TV OS has been flashed to your Raspberry Pi’s SD card, you can plug it back in and turn the Pi on.

In the next section, we will walk you through the initial setup experience.

First Setup Experience of Android TV on the Raspberry Pi
When you first start up Android TV on your Raspberry Pi, you will need to do some initial setup steps.


The following guide will walk you through these steps so that you can get up and running in no time.

1. The first screen that you will see is one saying that the Android TV OS is searching for accessories.

It can take a little while for the Raspberry Pi to finish this process, so please be patient.

Initial Startup Search for Accessories

2. Once the searching process completes, you will be greeted by the initial welcome screen of LineageOS.

You can begin the setup process of Android TV on your Raspberry Pi by clicking the “Next >” button.

Welcome to LinageOS TV
2. This build of Android TV for the Raspberry Pi comes with a EULA that prevents commercial use.


To proceed, you need to accept these conditions by clicking the “ACCEPT >” button.

Accept EULA for Android TV on the Raspberry Pi
3. We are finally at the first setting that you will need to define, which is an important one.

Use the select wheel in the middle of the screen to find and choose your native language (1.). For our example, we will be sticking with English.

When you have your language selected, click the “Next >” button (2.) to continue.


Choose Language for Android TV's Interface
4. You can now adjust the date and time settings for Android TV running on your Raspberry Pi.

If you have an ethernet connection, the Raspberry Pi may have already synchronized the time and date. However, in our case, the time zone was wrong, so we set that to “GMT+11:00“

Use the three options on the left hand of the screen to make sure the time and date is correct (1.).


Once you have verified all three values, click the “Next >” button (2.) to confirm the settings.

Select Date and Time
5. At this point, you will be greeted with two possible screens.

The Android TV operating system will try to detect if your Raspberry Pi has an ethernet connection automatically. If it does, Android TV will show you a screen that allows you to proceed without issue.


If you rely on a Wi-Fi internet connection, you will be greeted with the screen we have below. Use this dialog to choose your Wi-Fi network and connect to it.

Connect Android TV to Wi-Fi Network
6. This screen will allow you to control the location services that LineageOS makes available to applications.

If you want to outright block any apps from ever using your location, you can use this setting.


Once you have made your choice, click the “Next >” button to confirm it.

Choose Location Services
7. We are also able to switch off certain features of LineageOS.

The only one currently shown within this interface is LineageOS’s diagnostic and usage data. By default, the operating system will automatically report back information to improve the Android TV operating system.

You can disable this if you would prefer no data being sent back to the team.


With this setting enabled, or disabled, click the “Next >” button to proceed.

Enable or Disable LineageOS Features
8. You can also set a PIN to protect your device from unwanted access.

To use Android TV on your Raspberry Pi, the user will have to enter the provided password, PIN, or pattern.

As we aren’t too worried about access, we clicked the “SKIP >” button in the bottom right.


Configure PIN for Android TV on the Raspberry Pi
9. The last thing you will be asked is if you want to restore your apps and data.

If you have a previous LineageOS backup, you can click the “RESTORE FROM BACKUP” button to start the restoration process.

Alternatively, you can finish the Android TV setup experience by clicking the “SKIP >” button.


10. At this point, you should now have Android TV up and running on your Raspberry Pi.

You will notice that the interface is almost empty at the moment. This is because most of Android TV’s services are provided through Google’s apps.

Don’t worry though, installing the Google Apps is not that complicated of a process.

Android TV Running on the Raspberry Pi without GApps
Recovery Mode on Android TV

At the moment, our setup of Android TV on the Raspberry Pi is looking a bit barebones.

To get around this and to install extra packages like the Google Apps, we will need to make use of the inbuilt recovery mode.

The recovery mode is helpful for sideloading system applications as well as expanding the filesystem.

Enabling Developer Mode
To access the recovery mode of Android TV on our Raspberry Pi, we will need to activate the developer mode.

The developer mode allows us to change more advanced options that are usually hidden within the interface.


1. To get started, we need to open up the settings interface of Android TV.

You can access this by clicking the cog that is located on the top right of the screen.

Open Settings Panel

2. A menu should now have popped up on the right side of your screen.

To proceed, you need to click the “Device Preferences” option.

Change to Device Preferences
3. Within the device preferences screen, you should see a heap of different submenus.

Find the “About” option at the top of the page and click it.


Open Android TV About Menu

4. Scroll down the side menu until you find the option labeled “Build“.

You will need to click this option six times to activate developer mode.

Once the mode has been activated, you should see a message appear on the screen notifying you that developer mode is now active.

Click to Activate Developer Mode

Turning on Advanced Reboot
With the developer mode active, we can enable the advanced reboot feature of this Android TV build for the Raspberry Pi.

This feature will allow us to boot directly into recovery mode without relying on using the terminal.

1. We need to return to the “Device Preferences” options page.

If you are on the about page from the previous section still, you can press the F2 key to go back.


2. Once you are back in the “Device Preferences” menu, look for the “Developer options” menu.

Once you find this menu you need to click it.

Open Raspberry Pi Android TV Developer Options

3. You should now be in the “Developer options” menu.

You will see a list of advanced features, but the one we are after is called “Advanced reboot“.

Once you find this option, you need to toggle it on by clicking it. The toggle should turn a blue color once it has been successfully enabled.

Enable Advanced Reboot Option

Rebooting into Recovery Mode
With both the developer mode and advanced reboot options enabled, we can finally boot into recovery mode.

The process of booting your Raspberry Pi into Android TV’s recovery mode is straightforward now that those options have been enabled.

1. We need to return to the “Device Preferences” menu.

If you are still in the “Developer options” menu, you can go back to this menu by pressing the F2 key.


2. Once you are back in the “Device Preferences” menu, you can safely proceed.

Find and click the “About” option that you should locate at the top of the sidebar.

Finding the Reboot Option on Android TV

3. Within the “About” menu, you should see the “Restart” option.

You need to click this option as it is what will allow us to reboot into recovery mode.

Select Restart Option
4. Thanks to us enabling the “Advanced reboot” option earlier, you should have some additional options on this page.

Find and click the recovery option to boot your Android TV device into recovery mode.


Boot into Recovery Mode
Please note, before rebooting, make sure you have the USB with the files you want to flash plugged into your Raspberry Pi.

Running GApps on Android TV with the Raspberry Pi

Now that you have recovery mode enabled on your Raspberry Pi’s Android TV installation we can now get the Google Apps installed.

We will split this into two sections. One that covers installing the GApps package itself and another shows you how to complete the initial setup experience.

Installing GApps using Recovery Mode
At this point, you should now be booted into your Raspberry Pi’s recovery mode for Android TV.

Using this recovery mode, we will install the Google Apps to your Android TV installation.

1. As installing the GApps changes the system partition, we will need to allow it to modify the system partition.


You can do this by swiping the “Swipe to Allow Modifications” option to the right.

Swipe to Allow System Modifications

2. We will now need to make sure we have everything mounted so that GApps can be installed.

To do this, we will need to switch to the mount menu by clicking the “Mount” option.

Change to Mount Options
3. Within this menu, there are four partitions that you need to make sure are selected (1.). Boot, System, Data, and USB should all have their checkboxes ticked.


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

Select Partitions to Mount

4. Within this dialog box, ensure that your USB storage has been selected and not the internal storage (1.).

If you have the USB option selected, click the “OK” button to proceed.

Choose Storage Device to Mount

5. Now, return the main menu of the recovery tool.

The easiest way to do this is to click the home icon at the bottom of the screen.

Change to Home Menu from Mount Page
6. Now click the “Install” menu option.

This option should be the one located in the top right.


Change to Install Menu

7. You should now see a list of all the files on your USB file.

Within this list, look for the “open_gapps” zip file and click it to begin the install process.

Install GApps to Android TV on Raspberry Pi

If you don’t see the ZIP file on your USB device, you may have to restart your device then boot back into recovery mode.

7. To flash the GApps to your Raspberry Pi’s Android TV system, you need to swipe the bottom right option.

After you swipe this option, the recovery tool will begin to flash the Google apps to your device.

Swipe to confirm GApp Flash

8. Once the GApps has been written to the Android TV operating system, we need to return to the homepage.

You can go back to the home menu by clicking the home icon at the bottom of the screen.

Install Complete Go to Home
9. We are almost done. The last thing we need to do is factory reset the device.

Within the home menu, click the “Wipe” option located on the screen’s top right.

Change to Wipe Menu
10. Now, swipe the “Swipe to Factory Reset” option.

Swiping this option will wipe your data, cache, and dalvik files. Not doing this can lead to issues with running the Google Apps.

Swipe to confirm Wipe

11. Once the Raspberry Pi finishes wiping the required files, you can boot back into Android TV.

All you need to do to reboot into the normal operating system is click the “Reboot” button.

Reboot Raspberry Pi Back to Android TV
First Boot of Android TV with GApps
When you first start up your Raspberry Pi after installing the Google Apps to Android TV, you will need to complete a few steps.

1. The first screen will have a picture of a remote and a countdown timer.

You should be able to press the F1 key to skip past this screen.

Press F1 To Bypass Menu
2. Next, you need to select the language you want to use for the Google Apps.

Scroll through this menu until you find the correct language.

Choose Google Language
3. At this point, you will be asked to connect to your network.

We were already connected using ethernet, but you can also use this interface to connect to a Wi-Fi network.

Connected Using Ethernet Dialog
4. You will now be required to login to your Google account.

You can begin the login process by clicking the “Sign In” button.

Sign in to Google Account
5. You can choose the method that you want to use to login to your Google account.

We had issues with the “use your phone or computer” method, but it is still worth trying as it is typically faster.

Choose Google Login Method
Follow the following prompts to login to your Google account.

6. After logging in, you will need to agree to Google terms of service.

Accept Google Terms of Service
You can use this screen to read each of the three terms. Once you are done, you can click the “Accept” button to agree to the terms.

7. Google will also want you to choose whether they can use your location.

Either select the Yes or No option to finish up the setup process.

Enable Google Location Services
8. You will be welcomed to your Android TV powered Raspberry Pi.

You can click to move to the next part of the slide.

Raspberry Pi Android TV Welcome Screen
9. Finally, you will now have Android up and running on your Raspberry Pi with the Google Apps.

You should now see that the interface has now been populated with data from Google’s services.

Raspberry Pi Android TV Setup and Running with GApps
Expanding the Data Partition for Android TV on your Raspberry Pi
By default, when you install Android TV to your Raspberry Pi, it will not use up your SD Card’s full size.

Thanks to KonstaKANG, there is a way around this by flashing a special package they have written using the recovery mode.

If you appreciate their work, consider donating through their website, as this tutorial wouldn’t be possible otherwise.

There are two main things this package contains. First is a compiled version of fdisk for ARM. This binary is used to calculate the size of the storage device.

The other is a batch script that handles the whole process. The script will detect the required size needed for the partitions then automatically resize them to fill out the entirety of your SD card.

1. First, you need to download the resize package for Android TV.

Once downloaded, you need to copy it over to a USB drive then plug that drive into your Raspberry Pi.

2. Your next step is to get back into recovery mode.

If you have just installed the GApps package, that means you will have to follow all of the steps in the “Recovery Mode on Android TV” section.

3. Once you have booted back into the recovery mode, you can proceed.

As we need to flash this package, we will need to click the “Install” menu option.

Change to Install Menu
4. Within the file list on this page, find the package called “lineage-18.1-rpi-resize-konstakang.zip

Once you have found it, click the file to begin the installation process.

Install Resize Data Partition Package
5. You will have one last final chance not to run the resizing script.

Swipe the toggle in the bottom right-hand corner to begin the resizing process.

Swipe to Flash Resize Script to Android TV
6. Once the script has finished resizing the data partition to fill out the SD card, you can reboot your device.

To do this, all you need to do is click the “Reboot” button.

Reboot Back to OS
7. When rebooting your device, you may be given a few options.

To get back into your Android TV powered Raspberry Pi, click the “System” option.

Choose System as Reboot Option
8. Once your Raspberry Pi finishes rebooting, you should now have access to the entirety of your SD card’s space.

Conclusion
Hopefully, this guide will have shown you how to install and setup Android TV on a Raspberry Pi.

Android TV is a version of the Android operating system that has been optimized for TVs. It uses a different interface and allows apps to target a different form factor easily.

To make your life easier when using this operating system, there are a couple of key binds you might want to remember.

F1 = Home, F2 = Back, F3 = Multi-tasking, F4 = Menu, F5 = Power, F11 = Volume Down, and F12 = Volume Up.

We have also walked you through the steps to enable the recovery menu and install the Google Apps.

If you have had any issues with installing Android TV, please leave a comment below.

You can also check out some the other operating systems that you can run on the Raspberry Pi.
https://pimylifeup.com/raspberry-pi-android-tv-lineageos/
_________________________