android runtime_error ai_generated true

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

ID: android/navigation-unknown-deeplink-host

Also available as: JSON · Markdown · 中文
87%Fix Rate
84%Confidence
1Evidence
2023-11-20First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Navigation 2.6.0 active
Navigation 2.7.0 active
Android 12 active
Android 13 active

Root Cause

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

generic

中文

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

Official Documentation

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

Workarounds

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

中文步骤

  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.

Dead Ends

Common approaches that don't work:

  1. 80% fail

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

  2. 90% fail

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

  3. 70% fail

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