Flutter开发Android应用集成Google Assistant遇阻求助
关于Flutter Android应用集成Google Assistant App Actions的工具链故障排查问题
我正在为基于Flutter开发的Android应用集成Google Assistant,希望通过“Hey Google,在My Cat应用中查看状态”这类指令触发应用内代码,流程为先跳转至原生Android端,再传递给Flutter层。我选择了App Actions方案,已遵循官方文档的前置要求,但工具链出现故障,无法正常运行。
当前情况
- 应用已上线生产环境,现有构建未包含shortcuts.xml资源及清单文件中的对应meta-data;
- 我并非Google Play Console项目的所有者,仅为项目成员;
- 已使用同一Google账号登录Android Studio、实体Android设备及Google Play Console;
- 无法正常使用Android Studio的Google Assistant插件及App Actions Test Tool插件,已尝试Apple Silicon架构的Dolphin、Electric Eel、Hedgehog、Koala版本,均无法成功运行。其中Electric Eel版本表现最接近预期:打开Flutter项目创建预览时,进度条短暂闪烁后无反应;打开/android目录创建预览时,出现错误:
Google Assistant plugin v3.2.2
Preview Creation Error Status Code: 500 Message: Internal error encountered.
Create shortcuts.xml - 已在MainActivity的清单文件中添加代码:
<meta-data android:name="android.app.shortcuts" android:resource="@xml/shortcuts" /> - 已配置
app/src/main/res/xml/shortcuts.xml文件,内容如下:<?xml version="1.0" encoding="utf-8"?> <shortcuts xmlns:android="http://schemas.android.com/apk/res/android"> <capability android:name="actions.intent.GET_SERVICE_OBSERVATION"> <intent android:targetPackage="cat.my.app" android:targetClass="cat.my.app.MainActivity"> <parameter android:name="serviceObservation.measuredProperty.name" android:key="name" /> <parameter android:name="serviceObservation.aboutService.description" android:key="description" /> <parameter android:name="serviceObservation.endTime" android:key="endTime"/> <parameter android:name="serviceObservation.startTime" android:key="startTime"/> </intent> </capability> <shortcut android:shortcutId="status" android:shortcutShortLabel="@string/status_short_label" android:shortcutLongLabel="@string/status_long_label"> <capability-binding android:key="actions.intent.GET_SERVICE_OBSERVATION"> <parameter-binding android:key="serviceObservation.measuredProperty.name" android:value="@array/status_synonyms" /> </capability-binding> </shortcut> </shortcuts>
寻求排查方向
- 是否存在可正常使用的Android Studio/Google Assistant插件版本?
- 非项目所有者的身份是否会导致该问题?
- 上传包含shortcuts.xml的构建至Google Play能否启用App Actions测试?
内容的提问来源于stack exchange,提问作者tudor
相关产品推荐
相关产品推荐

