'navigation navGraphViewModels cause IllegalArgumentException

In my code I do like this: private val accountDetailsViewModel: AccountDetailsViewModel by navGraphViewModels(R.id.account_subgraph) { defaultViewModelProviderFactory }

But it crashes on firebase crashlytics:

No destination with ID 2131361857 is on the NavController's back stack. The current destination is a(ph.com.globe.globeonesuperapp:id/dashboardFragment) label=DashboardFragment class=ph.com.globe.globeonesuperapp.dashboard.DashboardFragment

I tracked the code and noticed that the crash is fromfindNavController().getBackStackEntry(navGraphId) . The destination is not on the back stack. But I don't know why and how can I fix that.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source