You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

.NET MAUI适配Android TV后Google Play显示不兼容问题求助

解决.NET MAUI Android TV应用Google Play兼容性问题

针对你遇到的问题——已添加LEANBACK_LAUNCHER IntentFilter,模拟器正常但Google Play上TV设备不兼容、应用未在TV端商店显示,可按以下步骤排查解决:

1. 确保AndroidManifest满足TV核心配置要求

(1)添加TV横幅图标

Android TV应用必须设置横幅图标,否则Play商店会过滤掉TV设备:

  • 在Platforms/Android/Resources/drawable目录下添加符合规格的横幅图(建议尺寸:320x180px,PNG格式),命名为banner.png
  • 在Platforms/Android/AndroidManifest.xml的<application>标签中添加属性:
    android:banner="@drawable/banner"
    

(2)确认IntentFilter完整配置

确保MainActivity同时包含手机和TV的启动IntentFilter:

  • 保留默认的手机端LAUNCHER过滤器,同时添加TV端LEANBACK_LAUNCHER过滤器,最终MainActivity.cs的属性应类似:
    [Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
    [IntentFilter(new[] { Android.Content.Intent.ActionMain }, Categories = new[] { Android.Content.Intent.CategoryLauncher })]
    [IntentFilter(new[] { Android.Content.Intent.ActionMain }, Categories = new[] { Android.Content.Intent.CategoryLeanbackLauncher })]
    public class MainActivity : MauiAppCompatActivity
    {
        // ... 你的业务代码
    }
    
  • 构建后检查生成的Manifest(路径:obj/[Debug/Release]/netX.X-android/android/AndroidManifest.xml),确认两个IntentFilter都存在。

2. 声明TV不支持的硬件功能为非必需

Android TV设备无触摸屏、电话等硬件功能,若应用隐含依赖这些功能,需在AndroidManifest.xml中声明为非必需:

<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<uses-feature android:name="android.hardware.telephony" android:required="false" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.microphone" android:required="false" />

根据你的应用实际使用情况,补充其他非必需的硬件功能声明。

3. 配置TV兼容的主题

若使用同一Activity支持手机和TV,需确保主题在TV设备上正常适配:

  • 在Platforms/Android/Resources/values/styles.xml中添加TV专用主题:
    <style name="Maui.TvTheme" parent="@style/Theme.Leanback">
        <item name="android:windowBackground">@drawable/splash_background</item>
        <!-- 其他TV主题适配配置 -->
    </style>
    
  • 通过资源限定符让TV设备自动使用该主题:在Platforms/Android/Resources下创建values-tv目录,复制styles.xml到该目录并修改主题为Maui.TvTheme。

4. 检查Google Play控制台的兼容性报告

上传AAB/APK后,在Google Play控制台的设备兼容性页面查看具体不兼容原因:

  • 控制台会列出导致过滤的具体规则(如缺失横幅、未声明非必需功能等),根据提示针对性修复。

5. 验证APK/AAB的构建配置

确保MAUI的Android构建目标包含TV设备常用的ABI:

  • 在项目属性的Android选项中,勾选armeabi-v7a、arm64-v8a、x86_64(TV设备多使用这些架构)。

内容的提问来源于stack exchange,提问作者Abanoub Zak

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.06 15:40:48