Google Play Console发布Instant App提示默认URL为null如何解决
问题背景
通过Google Play Console发布Instant App时,控制台返回默认URL为null的报错。该应用此前发布从未出现同类问题,当前Instant App与主应用源码完全独立,且两边均已配置default URL参数。
以下是当前Instant App的Manifest配置(域名已做脱敏处理):
<activity android:name=".InstantPaymentHome" android:windowSoftInputMode="adjustResize" android:configChanges="locale" android:exported="true"> <meta-data android:name="default-url" android:value="https://www.mydomain.com.sa" /> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter android:autoVerify="true"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="https" android:host="mydomain.com.sa" android:pathPattern="/pay" /> </intent-filter> <intent-filter android:autoVerify="true"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="https" android:host="www.mydomain.com.sa" android:pathPattern="/pay" /> </intent-filter> <intent-filter android:autoVerify="true"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="http" android:host="mydomain.com.sa" android:pathPattern="/pay" /> </intent-filter> <intent-filter android:autoVerify="true"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="http" android:host="www.mydomain.com.sa" android:pathPattern="/pay" /> </intent-filter> </activity>
根因分析
报错核心原因是default-url配置与声明的路由匹配规则不匹配:
你配置的default-url为https://www.mydomain.com.sa(站点根路径),但当前Activity下所有带BROWSABLE分类的VIEW intent-filter都配置了android:pathPattern="/pay",仅能匹配带/pay后缀的路径,没有任何一条intent-filter可以匹配你填写的根路径default-url。Google Play在上传包体扫描Manifest时,找不到对应匹配的路由规则,就会判定default-url无效,返回null报错。
修复方案
任选一种方式调整即可解决问题:
- 方案1:修改default-url取值,和现有intent-filter规则对齐,将meta-data的value改为
https://www.mydomain.com.sa/pay - 方案2:新增一条匹配根路径的VIEW intent-filter,适配当前填写的default-url,配置示例如下:
<intent-filter android:autoVerify="true"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="https" android:host="www.mydomain.com.sa" /> </intent-filter>
校验规则提醒:Instant App配置的default-url,必须能被当前Activity下至少一个带
android.intent.category.BROWSABLE分类的VIEW intent-filter完全匹配,scheme、host、path三个部分缺一不可,任意维度不匹配都会被判定为无效配置。
如果调整配置后仍报相同错误,额外检查两点:
- 构建包体时Manifest没有被构建变体、渠道配置合并覆盖,可以解压最终上传的aab/apk包,检查根目录下的AndroidManifest.xml是否包含正确的default-url和对应匹配的intent-filter规则
- 域名根目录下的
.well-known/assetlinks.json配置正确,同时包含主应用和Instant App的签名证书SHA256指纹,文件支持公网HTTP/HTTPS访问,无跳转、无鉴权限制
内容的提问来源于stack exchange,提问作者Neernay
相关产品推荐
相关产品推荐

