Fixed
Status Update
Comments
il...@google.com <il...@google.com>
al...@gmail.com <al...@gmail.com> #2
No updates? This is still an issue...
cl...@google.com <cl...@google.com>
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit b2047b27300b0d36faa71dbcd05abba9958977d1
Author: Clara Fok <clarafok@google.com>
Date: Thu Jun 20 15:11:27 2024
Fix single top crash on shared startDestination
Navigation identifies a single top by matching a NavGraph startDestination with the latest NavBackStackEntry. However, different graphs can share the same startDestination route and causes false identification of a single top.
Now to determine if it is a single top, we take the expected singleTop stack (target node to its final startDestination), and try to match it with the latest entries in the backStack. This means different parents sharing the same startDestination are no longer considered as single top navigation.
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 294408596
Relnote: "Fix singleTop navigation crash when different NavGraphs shared the same startDestination."
Change-Id: I17b9466ce3411e0113d1f9a56faa8706577abc72
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraph.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
https://android-review.googlesource.com/3140241
Branch: androidx-main
commit b2047b27300b0d36faa71dbcd05abba9958977d1
Author: Clara Fok <clarafok@google.com>
Date: Thu Jun 20 15:11:27 2024
Fix single top crash on shared startDestination
Navigation identifies a single top by matching a NavGraph startDestination with the latest NavBackStackEntry. However, different graphs can share the same startDestination route and causes false identification of a single top.
Now to determine if it is a single top, we take the expected singleTop stack (target node to its final startDestination), and try to match it with the latest entries in the backStack. This means different parents sharing the same startDestination are no longer considered as single top navigation.
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 294408596
Relnote: "Fix singleTop navigation crash when different NavGraphs shared the same startDestination."
Change-Id: I17b9466ce3411e0113d1f9a56faa8706577abc72
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraph.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
cl...@google.com <cl...@google.com> #4
Fixed internally and available in navigation 2.8.0-beta05
.
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.8.0-beta05
androidx.navigation:navigation-runtime:2.8.0-beta05
Description
Component used: Navigation
Version used: androidx.navigation:navigation-compose:2.7.0-rc01 (same issue occurs with 2.6.0)
Devices/Android versions reproduced on: Pixel 6 / Android 13
Calling
NavController.navigate() { launchSingleTop = true }
when using two nested navigations graphs that both contain a node with the same nested route crashes with this stack trace:I have attached a sample project, here's the interesting part of it: