上传React Native AAB包到Google Play控制台提示shortcut缺失android:shortcutId属性
问题原因
- 核心错误为
shortcuts.xml中的<shortcut>节点未正确闭合:你配置的<shortcut>标签开启后,完成内部intent、分类、能力绑定配置后,没有添加</shortcut>闭合标签,导致整个XML结构解析异常,Google Play校验时无法正确识别已配置的android:shortcutId属性,触发缺少必填属性的报错。 - 次要可修复问题:
AndroidManifest.xml中<activity>的android:configChanges属性值拼写不完整,你写的是uiMod,正确应为uiMode,该问题不直接导致本次报错,建议同步修复避免后续运行异常。
修复方案
替换shortcuts.xml为如下修正后的内容即可,补充缺失的<shortcut>闭合标签:
<?xml version="1.0" encoding="utf-8"?> <shortcuts xmlns:android="http://schemas.android.com/apk/res/android"> <shortcut android:shortcutId="ID_test" android:enabled="true" android:shortcutShortLabel="@string/compose_shortcut_short_label" android:shortcutLongLabel="@string/compose_shortcut_long_label"> <intent android:action="android.intent.action.VIEW" android:targetPackage="com.nativebasetest2" android:targetClass="com.nativebasetest2.MainActivity" /> <!-- 如果你的快捷方式关联多个intent,在此处添加,列表最后一个intent决定用户启动快捷方式时看到的内容 --> <categories android:name="android.shortcut.conversation" /> <capability-binding android:key="actions.intent.OPEN_APP_FEATURE" /> </shortcut> <capability android:name="actions.intent.OPEN_APP_FEATURE"> <intent android:action="android.intent.action.VIEW" android:targetPackage="com.nativebasetest2" android:targetClass="com.nativebasetest2.MainActivity"> <extra android:key="requiredForegroundActivity" android:value="com.nativebasetest2/MainActivity"/> </intent> </capability> </shortcuts>
修复完成后重新打包App Bundle上传即可解决该报错。
内容的提问来源于stack exchange,提问作者Rahul
相关产品推荐
相关产品推荐

