How to Build Your Own Android TV Box with Raspberry Pi

How to Build Your Own Android TV Box with Raspberry Pi

So you have got a new Raspberry Pi and want to build something useful? Well, first and foremost, if you don’t have a separate monitor, no need to worry. You can use your Windows laptop as a monitor for Raspberry Pi and even set up VNC Connect on RPi for remote connection. However, if you are looking to build an Android TV Box with Raspberry Pi then you will need a separate monitor or TV. In this guide, we have explained the details on how to install Android TV on Raspberry Pi and get Google Play Store and Services. So on that note, let’s begin.

Build Your Own Android TV Box with Raspberry Pi (2021)

I have written this guide keeping beginners in mind so if you are completely new to Raspberry Pi, don’t worry. Just go by the instructions and you will be running your custom Android TV on Raspberry Pi. For your ease, you can jump between sections from the table below.

Requirements

1. You will need a monitor or TV to set up and install Android TV on Raspberry Pi. This can’t be done remotely.

2. HDMI cable based on your board. Raspberry Pi 4 will need a micro HDMI to HDMI cable whereas Raspberry Pi 3 will require an HDMI to HDMI cable.

3. Raspberry Pi 3 and 4 are only supported for Android TV and they must have at least 2GB of RAM.

4. A microSD card having free space of 16GB or more.

5. Keyboard and mouse. If you have a wireless combo one then that’s even better.

6. A power adapter based on your board.

Downloads

  • First of all, to build an Android TV Box with Raspberry Pi, you need to download Android TV OS for Raspberry Pi. KonstaKANG is a popular developer known for building all sorts of Android ROMs for Raspberry Pi. The TV OS is based on Lineage OS and is available in many versions including Android 9, 10, and the latest 11. Based on your board, you can download any Android TV version but I would recommend Android TV 10 for stability. That said, for this guide, I am trying out Android 11 just to check how well it runs. You can click here to head over to the download page for RPi 4. If you want to download Android TV OS for RPi3 then click on the Devices menu on the top-right corner.
Raspberry Pi 4 ROMS
  • Next, you need to download the GApps package as the Android TV build does not come with Google apps and services. If you are installing Android TV 10 then open this link and simply click on the download button (make sure “tvstock” is selected). If you are like me, trying a newly released Android TV 11 build then click here and download the “tvstock” test build.
Rpi Gapps package
  • Next, you need to download balenaEtcher (Free) to flash the Android TV OS onto the SD card.
balenaetcher download

Install Android TV on Raspberry Pi (2021)

1. Once you have downloaded the Android TV build, extract it and you will get an IMG file.

Install Android TV on Raspberry Pi

2. Next, fire up balenaEtcher and select the Android TV IMG file. In my case, it’s an Android TV 11 build, but you may have a different version. After that, choose the SD card and click on “Flash!“.

flash android tv to Rpi SD card

3. Once the flashing process is done, remove the SD card and insert it into the Raspberry Pi. In addition, connect a mouse and keyboard. Finally, connect the power source and HDMI cable to the monitor/TV.

raspberry pi 4

4. Within seconds, you will find Lineage OS loading up on the screen.

LineageOS startup screen

5. After a while, you will be on the barebone Android TV home screen. Now we need to add Google Play Store and Services on our Android TV. By the way, to go back, press the F2 key on the keyboard. And some keyboard shortcuts for Android TV on Raspberry Pi are: F1 = Home, F2 = Back, F3 = Multi-tasking, F4 = Menu, Press and hold F5 = Power Menu, F11 = Volume down, and F12 = Volume up.

Build Your Own Android TV Box with Raspberry Pi

Install Google Play Store and Services on Your Custom Raspberry Pi Android TV Box

1. Now that you have installed Android TV on Raspberry Pi, it’s time to add support for Google Play Store and other services. Use a thumb drive and move the GApps package (ZIP file) to Raspberry Pi from your computer.

gapps package to flash on TV

2. Once you have moved the GApps package, open Settings -> Device Preferences -> About -> Scroll down to the Build menu. Now, click on the “Build” menu 7-8 times continuously. It will enable Developer Options on Android TV.

Build number in Raspberry Pi Android TV

3. Next, go back to Device Preferences and scroll down. You will find “Developer Options“. Open it.

go to Developer options

4. Here, turn on “Advanced Reboot“.

Enable advanced reboot

5. Now, to restart Android TV on Raspberry Pi, open Settings -> Device preferences -> Reboot -> Recovery. This will take you to TWRP Recovery.

Restart to recovery

6. You will now boot into the TWRP recovery. If prompted, click on “Swipe to Allow Modifications”. After that, open “Install“.

install ZIP using twrp recovery

7. Here, choose the GApps package that we transferred to the Raspberry Pi.

flash open gapps package on Raspberry Pi Android TV

8. Finally, click on “Swipe to confirm Flash“.

confirm flashing

9. Now, click on the TWRP icon on the top-right corner and it will take you to the main menu. This time, move to Wipe -> Swipe to Factory Reset.

factory reset your Android TV

10. Once the reset is complete, click on “Reboot” on the same page.

reboot Android TV

11. Voila, you will boot directly into Android TV on your Raspberry Pi. And this time, you will be prompted with the Google Setup. Now, go ahead and follow the on-screen instructions. I will suggest you not add your primary Google account as Google has been lately terminating accounts for unknown policy violations. If you get a popup to set up a remote, press “Esc” on the keyboard. Further, if you face an error during Google login, use the remote option for on-device login.

android tv google experience

12. So here it is. Google Play Store, Chromecast, and all Google services are available on your Raspberry Pi-based Android TV and working absolutely fine. In case, Chromecast is not working or apps like Netflix are not available then follow the below fix.

android tv with Google Apps loaded

Fix Chromecast on Raspberry Pi-based Android TV Box

1. If Chromecast is not working on your Raspberry Pi, there is nothing to worry about. You can manually enroll your custom Android TV on Google’s list of certified devices. To begin with, install the Device ID app by Evozi (Play Store / APKMirror) on Raspberry Pi. Since the Play Store on Android TV does not have this app, you will have to sideload it.

Fix Chromecast on Raspberry Pi-based Android TV Box

2. Next, open the Device ID app and it will display the code for Google Service Framework (GSF). Click on it and copy the code.

copy gsf id

3. Now open google.com/android/uncertified on Raspberry Pi or your computer and log in with the same Google account that you have used on the Raspberry Pi. After that, paste the GSF code and click on “Register“. You have finally done it. Now, wait for 5-10 minutes and Chromecast should start working.

register uncertified device on Google certified devices website

4. If you are still facing issues then restart your RPi-based Android TV. Press and hold the F5 key and click on Restart. This time, Chromecast should work fine.

restart android tv to fix chromecast

5. To further customize your Raspberry Pi-based Android TV, head over to Settings -> Device Preferences -> Raspberry Pi Settings.

raspberry pi settings

6. You can even add an IR remote to your Raspberry Android TV setup. Just enable the Infrared remote toggle and use your IR remote to control Android TV. For more information, head over to the developer’s documentation.

use ir remote with raspberry pi android tv

Install Android TV on Raspberry Pi to Make Your TV Smart

So that is how you can install Android TV and utilize Raspberry Pi as an Android TV Stick or Box. I know the installation process is a bit lengthy, but once you set it up, everything works fine. I even tested the latest Android 11 build and it worked like a charm. So go ahead and try it out.

Additionally, we would recommend you install Pi-hole on your Raspberry Pi to clean your home network from ads and trackers. And if you are wondering, yes you can set up Raspberry Pi remotely without a monitor or Ethernet/HDMI cable. Anyway, that is all from us. If you are facing any issues then let us know in the comment section below.

14 Comments

  1. Hi,

    I am really struggling with the android Tv Box I installed on my Pi. I have Raspberry Pi 4B with 8Gb Ram yet I am not getting quality input.

    I tried installing 2 setups –
    1. Android 10 setup didn’t install properly. I always get stuck in an infinite loop of loader animation when trying to complete basic setup.
    2. Was able to install Android 11 one. But facing below problems –
    a. Prime Video Won’t work.
    b. Extreme Frame Drops in Hotstar, SonyLiv, MxPlayer etc. These are the apps that I had access to their premium content.
    c. Chromecast won’t work. Will try your solution to see if it works.
    d. I have a Jellyfin server that works flawlessly but it did on OSMC too. Only other app which works is Youtube
    e. I have a LG TV which has a smart Link functionality, which is really cool as I can use TV’s remote to control external connected devices too. It works on FireTV, Kodi, OSMC, Playstation. But not on this Android Setup.
    f. I have fan installed in my PI. Its extremely noisy. If I remove it becomes extremely hot. Even Jellyfin starts dropping frames.
    g. I think Widevine is the problem. But Android 11 setup I got from konstacong link is Arm64 and Widevine is only supported in ARM version. I am screwed here

    I want advise, which android tv version is stable and will run Jellyfin, Hotstar, SonyLiv, Youtube, Prime Videos and MxPlayer flawlessly ?

  2. Was able to get the setup done, until trying to install the GApps section. Using a keyboard with touch pad, I’m unable to swipe to confirm flash. Any Ideas anyone?

  3. Hi, I am going step by step, but after TWRP reboot my device not start. Only showing moving logo. I tried several times from the first step, but nothing else. Have you any idea please?

  4. Anybody get CEC to work on this box? Got it all setup but I can’t figure this out. Seems like a simple thing to do but I don’t see the option.

    Also, thanks for this guide. Super easy to setup following your guide.

  5. Hi… couldn’t test. Unfortunately Lineage OS doesn’t run on Raspi Pi4B instead it only enter on loop reboot. Tried all versions on Konstakang and even Pi3 version – none works.

  6. I tried to do this with an extra pi I had running around but for some reason the Raspberry Pi couldn’t connect to my wifi network and the KonstaKang Lineage OS has no way to skip adding a wifi network, even if you’re hard wired.

    I’ll add that I had Kodi installed in the Pi which could connect to wifi no problem, it was specifically an issue with KonstaKang, not the pi itself. And yeah, almost any android box or stick is gonna do the job better. Pi sucks.

  7. Pi 4 4GB = 67€, case 10€, power supply 10€, SD card 16GB 4€, HDMI cable 10€, remote 10€…

    Most cheap Android sticks that do only SD content = <40€

    Nice guide for tinkering, but not worth it for dedicated Android TV box 🙁

  8. Your requirements state:
    3. Raspberry Pi 3 and 4 are only supported for Android TV and they must have at least 2GB of RAM.

    The Raspberry Pi 3 came with only a maximum of 1 GB of RAM therefore the only Raspberry Pi candidate suitable for this project is the Raspberry Pi 4.

    Be guided accordingly.

    1. completely agree. But for fun I tried it on my Raspberry Pi 3B and it didn’t work. It installed lineage, but no Android TV. I got all the way to step 11 but my Pi 3B is just stuck on the lineage loading screen and won’t go past it. It’s been like this for the past 4 days. I left it thinking maybe because it has 1GB of RAM it may take a little longer but, nope! Just won’t load at all.

      Not sure why listing the Raspberry Pi 3 as part of the minimum requirements is there if 2GB of RAM is required.

  9. I have a 4K UHD TV and am currently using a generic Android TV box (running version 8.1) which is giving me high quality video output. Would Raspberri 4A or 4B be able to produce quality video output?
    Also, would I be able to install Android 10 on my current device A95X Max?
    Thanks!

  10. Can widevine certified working for level 1. To play full hd 1920x1080p from Amazon prime video and netflix.

Leave a Reply