在导航图中找不到与请求 NavDeepLinkRequest 匹配的导航目标 Jetpack Compose
Navigation destination that matches request NavDeepLinkRequest cannot be found in the navigation graph Jetpack Compose
我的导航图
composable(route = Screen.HomeScreen.route){
navigateToProfileScreen = { userId: String, userName: String, userAddress: String, userPhone: String, userProfileImage: String ->
navController.navigate(
Screen.ProfileScreen.withArgs
(
userId,userName,userAddress,userPhone,userProfileImage
))
composable(
route = Screen.ProfileScreen.route + "/{userProfileId}/{userProfileName}/{userProfileAddress}/{userProfilePhone}/{CurrentUserProfileImage}",
arguments = listOf(
navArgument(name = "userProfileId"){
type = NavType.StringType
},
navArgument(name = "userProfileName"){
type = NavType.StringType
},
navArgument(name = "userProfileAddress"){
type = NavType.StringType
},
navArgument(name = "userProfilePhone"){
type = NavType.StringType
},
navArgument(name = "CurrentUserProfileImage"){
type = NavType.StringType
}
),
enterTransition = { _, _ ->
slideIntoContainer(
AnimatedContentScope.SlideDirection.Right,
animationSpec = tween(500)
)
},
exitTransition = { _, _ ->
slideOutOfContainer(
AnimatedContentScope.SlideDirection.Left,
animationSpec = tween(500)
)
}
) { entry ->
UserProfile(userId = entry.arguments!!.getString("userProfileId")!!,
userName = entry.arguments!!.getString("userProfileName")!!,
userAddress = entry.arguments!!.getString("userProfileAddress")!!,
userPhone = entry.arguments!!.getString("userProfilePhone")!!,
userProfileImage = entry.arguments!!.getString("CurrentUserProfileImage")!!,
navigateBack = { navController.popBackStack() })
}
错误行
在导航中找不到匹配请求 NavDeepLinkRequest{ uri=android-app://androidx.navigation/profile_screen/FBk4Nwq2/Ahmed /Cairo /01319/https://firebasestorage.googleapis03 } 的导航目的地图 NavGraph(0x0) startDestination={Destination(0x442b361f) route=home_screen}
在将 URL 作为参数传递之前,您必须对其进行编码,如下所示:
URLEncoder.encode(YOUR_URL, StandardCharsets.UTF_8.toString())
我的导航图
composable(route = Screen.HomeScreen.route){
navigateToProfileScreen = { userId: String, userName: String, userAddress: String, userPhone: String, userProfileImage: String ->
navController.navigate(
Screen.ProfileScreen.withArgs
(
userId,userName,userAddress,userPhone,userProfileImage
))
composable(
route = Screen.ProfileScreen.route + "/{userProfileId}/{userProfileName}/{userProfileAddress}/{userProfilePhone}/{CurrentUserProfileImage}",
arguments = listOf(
navArgument(name = "userProfileId"){
type = NavType.StringType
},
navArgument(name = "userProfileName"){
type = NavType.StringType
},
navArgument(name = "userProfileAddress"){
type = NavType.StringType
},
navArgument(name = "userProfilePhone"){
type = NavType.StringType
},
navArgument(name = "CurrentUserProfileImage"){
type = NavType.StringType
}
),
enterTransition = { _, _ ->
slideIntoContainer(
AnimatedContentScope.SlideDirection.Right,
animationSpec = tween(500)
)
},
exitTransition = { _, _ ->
slideOutOfContainer(
AnimatedContentScope.SlideDirection.Left,
animationSpec = tween(500)
)
}
) { entry ->
UserProfile(userId = entry.arguments!!.getString("userProfileId")!!,
userName = entry.arguments!!.getString("userProfileName")!!,
userAddress = entry.arguments!!.getString("userProfileAddress")!!,
userPhone = entry.arguments!!.getString("userProfilePhone")!!,
userProfileImage = entry.arguments!!.getString("CurrentUserProfileImage")!!,
navigateBack = { navController.popBackStack() })
}
错误行 在导航中找不到匹配请求 NavDeepLinkRequest{ uri=android-app://androidx.navigation/profile_screen/FBk4Nwq2/Ahmed /Cairo /01319/https://firebasestorage.googleapis03 } 的导航目的地图 NavGraph(0x0) startDestination={Destination(0x442b361f) route=home_screen}
在将 URL 作为参数传递之前,您必须对其进行编码,如下所示:
URLEncoder.encode(YOUR_URL, StandardCharsets.UTF_8.toString())