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

React Native Android App Links配置失败:digitalassetlinks超时及验证问题求助

React Native Android App Links配置问题

我正在给React Native Android应用配置App Links,用Android Studio的App Links Assistant生成了Digital Asset Links文件,release和debug签名的SHA256一致,文件已经部署到网站,用Postman和浏览器测试都正常,但Android Studio验证失败,调用Google的digitalassetlinks API时出现deadline_exceeded错误;用adb在模拟器测试时,一直弹出歧义对话框,试过各种网上的方案都没解决,求相关建议。

对应的AndroidManifest.xml代码如下:

<activity
        android:name=".MainActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
        android:exported="true"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <action android:name="android.intent.action.DOWNLOAD_COMPLETE" />
        </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" />
            <data android:scheme="https" />
            
            <data android:host="my_host" android:pathPrefix="/my_prefix"/>
        </intent-filter>
    </activity>

排查建议

  • 排查网络环境:deadline_exceeded通常是网络超时导致,尝试切换稳定的网络环境,或手动用curl调用API验证:
    curl https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=https://{你的实际域名}&relation=delegate_permission/common.handle_all_urls
    
    查看是否能正常返回包含你应用包名和SHA256的结果。
  • 验证Asset Links文件部署:确保文件放在https://{你的域名}/.well-known/assetlinks.json,响应头Content-Type为application/json,无重定向(返回200状态码),浏览器访问直接显示JSON内容。
  • 确认签名一致性:检查打包测试用的签名文件和生成assetlinks.json时使用的是同一文件,debug模式下可手动指定签名配置,避免Android Studio使用默认debug keystore导致不一致。
  • 检查Manifest配置细节:
    • 确认android:autoVerify="true"仅添加在处理VIEW的intent-filter上,无重复配置。
    • 替换my_host为实际域名,检查pathPrefix格式是否正确,无多余斜杠或拼写错误。
  • 模拟器测试日志排查:执行adb命令触发链接跳转:
    adb shell am start -a android.intent.action.VIEW -d "https://{你的域名}/my_prefix"
    
    查看logcat中AppLinks或DigitalAssetLinks相关日志,定位具体验证失败原因。
  • 清除验证缓存:在模拟器应用信息中清除默认打开方式设置,或执行adb命令清除应用数据:
    adb shell pm clear com.your.app.package
    
    替换为你的应用包名后重新测试。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.20 18:32:33