简体   繁体   中英

How to disable Android TV Support in my app? Manifest complaining about missing LEANBACK_LAUNCHER

I've been searching for a way to disable Android TV Support from the manifest. I know our app is incompatible and I've read that even when you aim at supporting Android TV, apps turn out unsupported anyways.

However, I have not found a way to stop the Manifest from asking for a INTENTBACK_LAUNCHER. I don't want to define one because I know that our app is not compatible with TV.

These are the warnings that I get right now:

Expecting uses-feature android:name="android.software.leanback" android:required="false" tag.

Expecting an activity to have android.intent.category.LEANBACK_LAUNCHER intent filter.

Hardware feature android.hardware.touchscreen not explicitly marked as optional

So when I try to supply the expected tags, even if I say the following:

uses-feature android:name="android.hardware.touchscreen" android:required="true"

It still sends a warning that it might not be supported by all TVs, which is nothing else than a warning but really annoying because I deliberately don't want to support Android TV. And even after I still get the LEANBACK_LAUNCHER intent filter warning as well.

Wouldn't requiring a touchscreen rid me of the manifest asking for a LEANBACK_LAUNCHER? I guess some TVs have touchscreens?

Anybody knows how to explicitly disable Android TV Support?

Thank you,

You can disable the lint checks by adding the tools:ignore attribute to your manifest as follows:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.example.sampleapp"
    tools:ignore="ImpliedTouchscreenHardware,MissingLeanbackLauncher,MissingLeanbackSupport">

I stuck in this but i think its just a bug that can not recognize my app it isn't an android TV app!

for now i add these lines in manifest and 2 of 3 warnings fixed

<uses-feature android:name="android.software.leanback" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>

Unfortunately i don't any solution for last warning yet

Expecting an activity to have android.intent.category.LEANBACK_LAUNCHER intent filter.

An application intended to run on TV devices must declare a launcher activity for TV in its manifest using a android.intent.category.LEANBACK_LAUNCHER intent filter. Issue id: MissingLeanbackLauncher

I can add LEANBACK_LAUNCHER but i don't want to! because i want to disable android tv support at all.

If you want, create an Activity and add this lines in manifest

  <activity
    android:name="com.example.android.TvActivity"
    android:label="@string/app_name"
    android:theme="@style/Theme.Leanback">

    <intent-filter>
      <action android:name="android.intent.action.MAIN" />
      <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
    </intent-filter>

  </activity>

And now give you error to add banner. add this line

<application
  android:banner="@drawable/banner" >

remove Leanback from your dependencies eg //implementation 'androidx.leanback:leanback:1.0.0'

remove from manifest

<!--uses-feature android:name="android.software.leanback" android:required="false" /-->
<!--category android:name="android.intent.category.LEANBACK_LAUNCHER" /-->
<!--application android:banner="@drawable/banner" -->

Whatever library you're importing that brought the problem, exclude leanback from it

implementation("com.library.using.tv:foo") {
    exclude group: 'androidx.leanback', module: 'leanback'
}

If you don't suspect any library then check your dependency tree .

从你的清单中删除它,你的错误就会消失

<uses-feature android:name="android.software.leanback" android:required="false" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM