Hi, I've just switched to acompanist navigation an...
# compose
v
Hi, I've just switched to acompanist navigation animation, and iam having the folowing error when I try to add the args to the
composable()
, removing the arguments makes evething works fine.
Copy code
Navigation destination that matches request NavDeepLinkRequest{ uri=<android-app://androidx.navigation/character> } cannot be found in the navigation graph NavGraph(0x0) startDestination={NavGraph(0x78da56c6) route=main startDestination={Destination(0x78d845ec) route=home}}
This is the code thats braking
Copy code
composable(
            route = MainRoutes.CharacterDetail.routeName,
           arguments = MainRoutes.CharacterDetail.navArgs, /*Comenting this line get things working again*/
            enterTransition = {initial, target -> null },
            exitTransition = {initial, target -> null },
            popEnterTransition = {initial, target -> null },
            popExitTransition = {initial, target -> null }

        ) { backStackEntry ->
            val character = MainRoutes.CharacterDetail.getNavArgs(backStackEntry)
            character?.let {
                CharacterScreen(
                    character = character,
                    onBack = { navController.popBackStack() })
            }
        }
i
So does
MainRoutes.CharacterDetail.routeName
equal
character
, because that's what you're trying to navigate to
v
yes thats it the value is
"character"
.
evethin works fine until I add nav args
i
Args you pass to that destination need to be part of the route, as per the docs: https://developer.android.com/jetpack/compose/navigation#nav-with-args
So I would expect your route to be
"character/{characterId}"
and have your destination correctly read that ID and retrieve the
Character
from your repository
v
Actually, I was passing a parcel to the route, i tried the id approach and everything works fine thanks for your help.