Fixed
Status Update
Comments
il...@google.com <il...@google.com>
cl...@google.com <cl...@google.com> #2
The deeplink URI you are using to navigate is missing the scheme. The default scheme is https://
so your URI should be https:///456
instead of /456
(which arguably /456
as a path is probably not the best).
val deepLinkIntent = Intent(
Intent.ACTION_VIEW,
"https:///456".toUri(),
this@MainActivity,
MainActivity::class.java
)
With that single change, it will work with Int, Long, Bool etc. That said, the deeplink should not have matched in the first place and should be no-op instead of matching and crashing from missing arg.
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit 88f53c5a7ed690179df3f3bb3499d24b31928d00
Author: Clara Fok <clarafok@google.com>
Date: Mon Mar 20 12:12:26 2023
Ensure Action/MimeType deeplink match fails when missing required arg
Navigation allows deeplink matching based on only Action or MIME type. This causes issues, ie NullPointerException, if the navigation is missing non-nullable NavArguments that are required by the NavDestination of the Action/MIME type.
Now when matching deepLinks based on Action or MimeType, navigation will require that all non-nullable NavArgument either has an arg value provided or has a default value.
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 271777424
Relnote: "Deeplink navigations based on Action/MimeType will now fail if the navigation operation is missing non-nullable NavArgument required by the NavDestination that the Action/MimeType matches with."
Change-Id: Ibfa17dd8043e478e330af5cbb4df865b8e494836
M navigation/navigation-common/src/main/java/androidx/navigation/NavArgument.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDeepLink.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestination.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerTest.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavInflaterTest.kt
M navigation/navigation-runtime/src/androidTest/res/navigation/nav_simple.xml
https://android-review.googlesource.com/2498738
Branch: androidx-main
commit 88f53c5a7ed690179df3f3bb3499d24b31928d00
Author: Clara Fok <clarafok@google.com>
Date: Mon Mar 20 12:12:26 2023
Ensure Action/MimeType deeplink match fails when missing required arg
Navigation allows deeplink matching based on only Action or MIME type. This causes issues, ie NullPointerException, if the navigation is missing non-nullable NavArguments that are required by the NavDestination of the Action/MIME type.
Now when matching deepLinks based on Action or MimeType, navigation will require that all non-nullable NavArgument either has an arg value provided or has a default value.
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 271777424
Relnote: "Deeplink navigations based on Action/MimeType will now fail if the navigation operation is missing non-nullable NavArgument required by the NavDestination that the Action/MimeType matches with."
Change-Id: Ibfa17dd8043e478e330af5cbb4df865b8e494836
M navigation/navigation-common/src/main/java/androidx/navigation/NavArgument.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDeepLink.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestination.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerTest.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavInflaterTest.kt
M navigation/navigation-runtime/src/androidTest/res/navigation/nav_simple.xml
cl...@google.com <cl...@google.com> #4
Fixed internally will be available in navigation 2.6.0-alpha09
.
na...@google.com <na...@google.com> #5
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-common:2.6.0-alpha09
androidx.navigation:navigation-runtime:2.6.0-alpha09
Description
Component used: Compose Navigation
Version used: 2.6.0-alpha06
Description: The app crashes on a deeplink if a composable destination has a navigation argument which is not String.
Code sample to reproduce:
The first button with " b/123 " route navigates successfully. The second that sends the deeplink with " b/456 " route causes a crash.
Stacktrace: