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

为何App Actions Test Tool不支持shortcuts.xml配置文件?

问题原因
  1. 你当前使用的App Actions Test Tool v3.5.5仅支持App Actions v2及以上版本,该版本已废弃了将App Actions能力写在shortcuts.xml中的旧方案,要求使用独立的actions.xml文件存放相关配置,工具扫描时只会识别actions.xml的引用,因此会抛出找不到配置的错误。
  2. 你当前的配置是App Actions v1版本的写法,该版本已停止官方维护和工具支持。
解决方案
  • 第一步:在项目res/xml目录下新建actions.xml文件,将原shortcuts.xml中与App Actions相关的配置迁移进去,根节点改为<actions>,原<capability>标签替换为<action>,示例如下:
<?xml version="1.0" encoding="utf-8"?>
<actions xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <action android:name="custom.actions.intent.PLUS_DAYS"
        queryPatterns="@array/PlusQueries">
        <intent
            android:action="android.intent.action.VIEW"
            android:targetPackage="com.noen.maihue.datetimeplus"
            android:targetClass="com.noen.maihue.datetimeplus.MainActivity">
            <parameter
                android:name="day_number"
                android:key="day_number"/>
        </intent>
    </action>
</actions>
  • 第二步:修改AndroidManifest.xml配置,新增App Actions专属的meta-data引用,原有静态快捷方式的配置可保留:
<activity android:name=".MainActivity">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    <!-- 原有静态快捷方式配置,不需要删除 -->
    <meta-data
        android:name="android.app.shortcuts"
        android:resource="@xml/shortcuts" />
    <!-- 新增App Actions配置引用 -->
    <meta-data
        android:name="com.google.android.actions"
        android:resource="@xml/actions" />
</activity>
  • 第三步:清理原shortcuts.xml中的<capability>相关App Actions配置,仅保留普通静态快捷方式的声明即可。
  • 第四步:同步项目后重新打开App Actions Test Tool,工具即可正常识别配置。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.09.28 21:06:04