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

React Native 0.70 Android Intent Filter配置问题:无法通过CHT启动应用

解决CHT App Launcher无法唤起自定义React Native 0.70应用的问题

你的核心问题是自定义应用的AndroidManifest.xml中intent-filter配置未正确匹配CHT发起的隐式Intent,导致系统无法定位到你的应用,转而列出其他匹配的应用。以下是具体排查和修正步骤:

  • 对齐CHT与Manifest的Intent配置
    确保CHT表单中配置的intent_action与Manifest里的<action>完全一致(大小写敏感)。比如CHT用com.yourapp.CHT_LAUNCH作为启动Action,Manifest中就要对应配置这个值。

  • 修正MainActivity的intent-filter配置
    给主Activity添加匹配CHT Intent的intent-filter,必须包含DEFAULT类别(隐式Intent的强制要求)。示例配置如下:

    <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize">
        <!-- 原有桌面启动的Intent Filter -->
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <!-- 新增匹配CHT的Intent Filter -->
        <intent-filter>
            <!-- 替换为CHT配置的自定义Action -->
            <action android:name="com.yourapp.CHT_LAUNCH" />
            <!-- 隐式Intent必须包含此类别 -->
            <category android:name="android.intent.category.DEFAULT" />
            <!-- 若CHT配置了自定义scheme,需添加对应Data项 -->
            <!-- <data android:scheme="yourapp-scheme" /> -->
        </intent-filter>
    </activity>
    
  • 验证CHT表单配置
    检查CHT的xlsx表单中App Launcher的参数:

    • intent_action必须和Manifest中的Action完全一致
    • 若设置了intent_category,需和Manifest中的<category>匹配
    • 若有intent_data,要对应Manifest里的<data>规则
  • 用adb命令测试Intent唤起
    直接通过adb验证Intent是否能唤起应用,排除CHT的问题:

    adb shell am start -a com.yourapp.CHT_LAUNCH -n com.yourpackagename/.MainActivity
    

    命令能唤起应用则Manifest配置正确,问题在CHT表单;不能唤起则继续检查Manifest的Action、Category或包名/Activity路径。

  • 核对包名与Activity路径
    确保Manifest中的包名和应用实际包名一致,Activity路径正确(嵌套子包需写全路径,比如com.yourapp.ui.MainActivity)。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.18 00:10:51