Thomas
01/29/2022, 1:27 AMFatal Exception: java.lang.IllegalArgumentException: No WearNavigation.Destination has been added to the WearNavigator in this NavGraph. For convenience, build NavGraph using androidx.wear.compose.navigation.composable.
at androidx.wear.compose.navigation.SwipeDismissableNavHostKt.SwipeDismissableNavHost(SwipeDismissableNavHostKt.java:166)
at androidx.wear.compose.navigation.SwipeDismissableNavHostKt.SwipeDismissableNavHost(SwipeDismissableNavHostKt.java:87)
... (redacted)
Note that it works great for most users, so far this crash is only affecting a few users. I am not able to reproduce it myself. I am creating my nav host like this:
SwipeDismissableNavHost(
navController = navController,
startDestination = "mydestname"
) {
// Note that composable is from androidx.wear.compose.navigation package.
composable("mydestname") {
...
}
... more composables
}
The crash seems unexpected to me as there are always destinations added, so I suspect this is a bug. This is using androidx.wear.compose:* snapshot 8104636 and androidx.navigation:* 2.4.0-rc01.
Any suggestions?SwipeDismissableNavHost
throws this exception if the backstack is not available:
https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:wear/com[…]ost.kt;l=166-169;drc=78d498661680a95d2705d5e6dbb1c0438c50fa30NavHost
from navigation, as that does not throw an exception but just shows nothing instead:
https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:navigati[…]NavHost.kt;l=139;drc=78d498661680a95d2705d5e6dbb1c0438c50fa30SwipeDismissableNavHost
should be changed to match the behaviour of NavHost
? So do not throw an exception if backstack is empty, but just show nothing.John Nichol
01/29/2022, 1:26 PMThomas
01/29/2022, 1:30 PMSteve Bower [G]
01/31/2022, 1:41 PMlouiscad
01/31/2022, 1:48 PMThomas
01/31/2022, 2:30 PMThis issue has *22 crash events* affecting *5 users*
Steve Bower [G]
02/01/2022, 6:27 PMThomas
02/01/2022, 7:08 PMSteve Bower [G]
02/02/2022, 12:36 PMThomas
02/04/2022, 8:29 PMnavController.popBackStack(Screen.Intro.route, true)
if (navController.backQueue.isEmpty()) {
navController.navigate(Screen.Groups.route)
}
What I am trying to do is navigate to another screen (groups) by popping the screen that is currently visible (intro). Either the groups or intro screen could be currently the root destination.
I have rewritten the code above to use popBackStack or use navigate/popUpTo (depending on which screen is the root). Will push a new update to see if this fixes the crash, that could take a few days for Google to review it.
Thanks a lot for your help so far looking into this, I really appreciate it.Steve Bower [G]
02/07/2022, 10:58 AMThomas
02/15/2022, 1:53 PMSteve Bower [G]
02/16/2022, 1:49 PM