Professional Documents
Culture Documents
Porting An Android App To Androidtv App: Piyush Kumar
Porting An Android App To Androidtv App: Piyush Kumar
Porting An Android App To Androidtv App: Piyush Kumar
There are millions of apps for Android and as Android TV is a modified version of Android, in theory it is possible for one
to run Android apps on any Android TV. But reality is not that simple and that is why there is huge difference in number
of apps in the Android TV app store. This is where Android comes handy by providing side loading option.
I started on the sideloading path assuming that it is going to be a straight forward affair and was surprised that it is much
more involved. With the help of DuckduckGo, Reddit and XDA I was able to side load few apps on my Sony TV. I decided
to document the steps so that someone in my situation can save some time (and probably improve on this).
But before you start, make sure that your app is not designed to work only in Portrait mode (as was case with few apps I
was trying) because it is a neck bending experience to use apps on TV when they are rendered at 90* angle.
Page 1
3. Getting the APK:
a. Download the app, that you want to set up on your TV, on your android Mobile phone.
b. Download an app to export the apk. In my case I used APK Extractor
c. Using the extractor app (APK Extractor), export the app. APK extractor would put the file in a folder called
"ExtractedApks" on your default phone memory
Note: you can get the apk directly from any apk repo websites but I chose this route for my own peace of
mind.
d. Export the extracted APK to the machine where we have set up apk2tv in previous steps.
4. Preparing the logo for the app:
a. Search for logo of the app on Duckduckgo image search
b. Save the logo that you like on your machine
c. Open the logo saved in above step in Microsoft Paintbrush
d. Click on the resize button --> click on pixel --> change the values to 320X180
e. Save the file as PNG
5. Modifying Apk:
a. Run APK2TV.exe ( I used run as administrator option in order to avoid any permission related issues)
b. Click on Load APK --> browse to the location where you have copied the extracted apk --> select the apk and
click Open
c. Once you click open in previous step, a command prompt would open and you would see tool decoding the
apk you selected. Once the decoding is completed system would give a prompt as shown below and you can
press any button to proceed.
d. Click on the Existing Banner radio button --> browse to the location where you have saved the logo of the
app and click Open
e. Click on "Convert" icon at the bottom and wait. It would take some time but in the end you would have the
apk present in the "Output Folder" location
6. Deploying the updated APK:
Page 2
6. Deploying the updated APK:
a. Copy the updated apk (from output folder) to a USB drive
b. Connect the USB drive to your TV
c. Open the file explorer/manager app on your TV
d. Browse the USB drive and install the updated apk
e. If everything goes well, you would have app icon appear on TV home screen
Hopefully this works for you and you are done. But in case you want to understand what is happening under the
hood, read on.
Apktool.jar: This is the 3rd party utility that is used to reverse engineer packaged android apps (apk files). It is able
to decode as well as rebuild the apk for usecases like localization, support for custom platforms etc. Under the
hood this utilizes Android Asset Packaging Tool (AAPT/AAPT2) to do the decompile and rebuild tasks.
Apk2TV: The person who wrote this tool is awesome as he made this exercise extremely easy. The tool uses the
apktool.jar for decode and rebuild but then adds few lines in AndroidManifest.xml. Android TV uses Leanback
launcher thus an app needs to have few tags in its AndroidManifest.xml for Leanback launcher to display it on
home screen. The modified APK contains those flags and thus after side loading Android TV starts to display the
app on home screen. Below given are the main tags I saw being added (for the app I was playing with) to the
AndroidManifest.xml by the tool:
In the application tag
android:banner="@drawable/ic_banner"
This path to convert normal Android apps to work on Android TV apps might not work in some cases and there is
not lot that we can do about it. The errors could be related to apktool or just the way AAPT works or may be
something else. Hope this helps.
Page 3