There are two different approaches to adding Android TV to your project. They are conceptually different but the code you have to write is almost the same for both of them, although in different places. According to the characteristics of your project, you may prefer one or another. These options are:
Building a separate APK for Android TV
Using the same APK for phones, tablets, and TVs
The default option of Android Studio is to create a build variant for Android TV. It did that when we used the wizard to set up our project and we added TV support. That is why we have the mobile
and tv
directories. The main project is mobile
and tv
is configured to be a build variant or "flavor".
Flavors are a powerful way to build different APKs from the same code base, allowing us to modify parts, be it code or resources. It is particularly useful when you have to publish the same game in different markets. On the other hand, if you have a single APK, it has to be able to adapt to the...