Android应用链接验证失败问题排查求助
Android应用链接无法验证问题详情
- 可通过命令
adb shell am start -W -a android.intent.action.VIEW -d https://example.com/ com.example.app直接启动应用 - 仅执行
adb shell am start -W -a android.intent.action.VIEW -d https://example.com/时,无法唤起应用,链接会通过Chrome打开 - 应用
com.example.app的「应用信息 > 默认打开 > 已验证链接」为空且置灰 - 执行
adb shell pm get-app-links com.example.app无任何输出 - 安装应用、打开应用并保持20秒以上,或执行
adb shell pm verify-app-links --re-verify重新验证时,用adb logcat -e "(IntentFilterIntentOp|IntentFilterIntentSvc)"未捕获到相关日志 - 执行
curl https://example.com/.well-known/assetlinks.json -I返回以下响应:
该HTTP/1.1 200 OK Date: Thu, 01 Jun 2023 09:05:51 GMT Content-Type: application/json Content-Length: 337 Connection: keep-alive Strict-Transport-Security: max-age=63072000; includeSubdomains; X-Content-Type-Options: nosniff Last-Modified: Thu, 01 Jun 2023 08:40:55 GMT ETag: "151-5fd0d65109bf8" Accept-Ranges: bytes Cache-Control: max-age=2592000 Expires: Sat, 01 Jul 2023 09:05:51 GMT Vary: User-Agent X-FRAME-OPTIONS: SAMEORIGIN X-XSS-Protection: 1; mode=block Content-Security-Policy: default-src 'self' 'unsafe-inline' 'unsafe-eval' data: https: *.googleadservices.com *.doubleclick.net *.google.com *.googletagmanager.com *.gstatic.com *.googleapis.com *.facebook.net; frame-ancestors 'self' Referrer-Policy: no-referrer Feature-Policy: microphone 'none'; geolocation 'none' Expect-CT: max-age=0 CF-Cache-Status: DYNAMIC Set-Cookie: __cf_bm=wkXkFwgBEGc6Ghwu.9PHLwFccvVaqOaV0zj8WyBdDf0-1685610351-0-AeqBrPqaw4CpOpFKrWxzWbN7139MTi3/194uecclD0smsP++N2TXfshkdaoVy4FtqyWm1JfEkkKH3joUoPoU2HY=; path=/; expires=Thu, 01-Jun-23 09:35:51 GMT; domain=.example.com; HttpOnly; Secure; SameSite=None Server: cloudflare CF-RAY: 7d064c15bf09f44a-BOMassetlinks.json内容如下,其中SHA256签名与发布APK所用密钥签名匹配:[ { "relation": ["delegate_permission/common.handle_all_urls"], "target": { "namespace": "android_app", "package_name": "com.example.com", "sha256_cert_fingerprints": ["SO:ME:FA:KE:SH:A2:56:5C:57:D7:22:D4:ED:A3:C4:97:23:A2:4E:B0:30:93:A5:57:39:98:B1:E0:3E:03:64:73"] } } ] - 执行
curl "https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=https://example.com&relation=delegate_permission/common.handle_all_urls"返回以下JSON:{ "statements": [ { "source": { "web": { "site": "https://example.com." } }, "relation": "delegate_permission/common.handle_all_urls", "target": { "androidApp": { "packageName": "com.example.app", "certificate": { "sha256Fingerprint": "SO:ME:FA:KE:SH:A2:56:5C:57:D7:22:D4:ED:A3:C4:97:23:A2:4E:B0:30:93:A5:57:39:98:B1:E0:3E:03:64:73" } } } } ], "maxAge": "589172.377669267s" } - 仅执行
adb shell pm get-app-links --user cur com.example.app时得到以下输出:User 0: Verification link handling allowed: true Selection state: Disabled: example.com - 已在应用清单中添加自定义URL Scheme,功能正常。
测试设备为Android 13(一加Nord 2)和Android 12设备,未找到adb shell pm get-app-links com.example.app无输出情况的相关文档。
内容的提问来源于stack exchange,提问作者Mushaheed Syed
相关产品推荐
相关产品推荐

