I navigation to a compose fun by using deeplink ...
# compose-android
u
I navigation to a compose fun by using deeplink from a fragment. app crash. and the log is java.lang.IllegalArgumentException: Navigation destination that matches request NavDeepLinkRequest{ uri=autra://tech.autra.auto/page_vehicle_info } cannot be found in the navigation graph NavGraph(tech.autra.auto:id/nav_graph) startDestination={Destination(tech.autra.auto:id/FragmentMain) class=tech.autra.auto.baidumap.FragmentMain} . fragement and compose fun is in different graph. this is fragment code
Copy code
TrailerDialog(showDialog,
    viewModelAutra,
    modifierClick = {
        Timber.tag("TrailerDialog").e("modifierClick")
        showDialog.value = false
        // findNavController().navigate(route = PageVehicle.PageVehicleSelect.name)
        findNavController().navigate(deepLink = Uri.parse(VehicleInfoObject.vehicleInfo) )
    }
) {
    Timber.tag("TrailerDialog").e("yesClick")
    showDialog.value = false
}
this is compose fun with Navhost
Copy code
@Composable
fun PageVehicleInfoNaviHost(viewModelVehicleInfo: ViewModelVehicleInfo = viewModel(), viewModelAutra: AutraViewModel) {
    val navController: NavHostController = rememberNavController()
    viewModelVehicleInfo.setAutraViewModel(viewModelAutra)

    NavHost(
        navController = navController,
        startDestination = PageVehicle.PageVehicleInfo.name,
    ) {
        composable(route = PageVehicle.PageVehicleInfo.name,
            deepLinks = listOf(navDeepLink {
                uriPattern = VehicleInfoObject.vehicleInfo
                action = Intent.ACTION_VIEW
            })
        ) {
            PageVehicleInfo(onSettingClick = {
                navController.navigate(route = PageVehicle.PageVehicleSelect.name)
            }) {
                navController.popBackStack()
            }
        }
and compose fun PageVehicleInfoNaviHost is also at a fragment which is at the graph same as TrailerDialog