Search code examples
androidandroid-manifestandroid-tv

Added Android TV to existing app, now can only support back to Android SDK 17


I added Android TV support to an existing app. I then had to increase the min SDK version to 17 from 14. Indication was the leanback library could not support below SDK 21, however, I seem to be able to use 17 as the minimum. I did have to add the following to my Android Manifest:

<uses-sdk
    xmlns:tools="http://schemas.android.com/tools"
    tools:overrideLibrary="android.support.v14.preference" />

This has to be a configuration issue in the manifest. Is there any further configuration required? The app does work on phones, tablets, and Nexus Player. It just doesn't support back to Android SDK 14, which has been requested by some users.

Code is here: https://github.com/MythTV-Clients/MythtvPlayerForAndroid


Solution

  • The Leanback library has a minimum SDK version of 17. If you want to add Android TV support, you will need to add another module.

    Looking at your project, it seems like "domain" and "presentation" are separate modules for the project. You can add one for "TV" and put TV specific code there. When the user installs the APK the correct version will be downloaded.

    You can put phone specific code in a "phone" module. Shared code can be a "shared" module which can be compiled for both platforms.

    Let me know if you have any questions with using modules.