Xamarin Forms深度链接配置后无法唤起应用求助
Android App Links 无法唤起应用的排查方案
以下是针对你的Xamarin.Forms应用配置App Links后无法唤起的排查步骤:
1. 验证网站assetlinks.json配置
- 确认
https://polis.ateshgah.com/.well-known/assetlinks.json文件存在且可访问,格式需严格符合要求:[{ "relation": ["delegate_permission/common.handle_all_urls"], "target": { "namespace": "android_app", "package_name": "你的应用完整包名", "sha256_cert_fingerprints": ["应用签名的SHA256指纹"] } }] - 注意debug和release包的SHA256指纹完全不同,可通过以下命令获取:
keytool -list -v -keystore 你的签名文件路径 -alias 别名 - 检查服务器返回该文件的
Content-Type必须为application/json,不能是text/plain。
2. 检查IntentFilter配置细节
- 确认MainActivity上的IntentFilter属性无拼写错误,
AutoVerify = true需同时对应网站配置和应用签名; - 确保应用包名与assetlinks.json中的
package_name完全一致(区分大小写); - 已正确添加
CategoryDefault和CategoryBrowsable,你的现有配置这部分没问题。
3. Xamarin.Forms AppLinks初始化检查
- 确认
AndroidAppLinks.Init(this)的调用位置正确,需在LoadApplication之前执行:protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); AndroidAppLinks.Init(this); LoadApplication(new App()); } - 检查Xamarin.Forms.AppLinks NuGet包版本与Xamarin.Forms主版本兼容,建议更新到最新稳定版。
4. 工具测试与日志排查
- 用adb命令直接测试Intent唤起:
如果能唤起应用,说明IntentFilter配置有效,问题出在AutoVerify或浏览器支持;adb shell am start -W -a android.intent.action.VIEW -d "https://polis.ateshgah.com/" - 查看AutoVerify状态:
若返回adb shell dumpsys package domain-preferred-apps | grep polis.ateshgah.comstatus=always则验证通过,ask或never表示验证失败; - 查看logcat日志,搜索
AppLinks、IntentFilter或assetlinks关键词,定位验证失败的具体原因。
5. 其他注意事项
- 仅Android 6.0(API 23)及以上版本支持App Links;
- 应用需通过签名安装(debug签名或release签名),直接调试运行可能影响AutoVerify;
- 部分第三方浏览器可能不支持App Links,优先用Chrome测试。
内容的提问来源于stack exchange,提问作者Emin Niftiyev
相关产品推荐
相关产品推荐

