android runtime_error ai_generated true

java.lang.IllegalArgumentException:找不到深度链接的目标:https://example.com/path

java.lang.IllegalArgumentException: Navigation destination cannot be found for deep link: https://example.com/path

ID: android/navigation-unknown-deeplink-host

其他格式: JSON · Markdown 中文 · English
87%修复率
84%置信度
1证据数
2023-11-20首次发现

版本兼容性

版本状态引入弃用备注
Navigation 2.6.0 active
Navigation 2.7.0 active
Android 12 active
Android 13 active

根因分析

导航组件无法将深度链接 URI 匹配到 NavGraph 中任何已注册的目标,因为深度链接声明缺失或格式错误。

English

Navigation component cannot match a deep link URI to any registered destination in the NavGraph due to missing or malformed deep link declaration.

generic

官方文档

https://developer.android.com/guide/navigation/navigation-deep-link

解决方案

  1. Add a `<deepLink app:uri="https://example.com/path" />` element inside the corresponding `<fragment>` or `<activity>` in your nav_graph.xml file.
  2. Verify the deep link URI pattern matches exactly, including path and query parameters. For dynamic paths, use placeholders like `{id}` in the URI.

无效尝试

常见但无效的做法:

  1. 80% 失败

    Adding `<intent-filter>` in AndroidManifest.xml for the activity without corresponding <deepLink> in NavGraph causes mismatch.

  2. 90% 失败

    Hardcoding the deep link URI in code without registering it in the NavGraph XML leads to the same error.

  3. 70% 失败

    Using `app:uri` with incorrect scheme (e.g., 'http' instead of 'https') causes no match.