umtblbl
umtblbl

Reputation: 123

Android No destination with ID 2131362800 is on the NavController's back stack

I've encountered a severe crash on Firebase that happens on average 6 times per user. But do you have any ideas, help for this error that I can never repeat? It would be a good workaround though if I could at least remove the crash

Fatal Exception: java.lang.RuntimeException Unable to start activity ComponentInfo{com.my.company/com.my.company.ui.MainActivity}: java.lang.IllegalArgumentException: No destination with ID 213136280 is on the NavController's back stack. The current destination is f0(com.my.company:id/nav_graph_home_page) startDestination={a(com.my.company:id/homeFragment) label=HomeFragment class=com.my.company.ui.home.HomeContainerFragment}

Upvotes: 2

Views: 685

Answers (1)

zeroDivider
zeroDivider

Reputation: 1089

The problem is mostly happening to android 13 users and cause is most likely that system is killing activity after a while - more often then on previous versions (at least it is for me). When it happens, somehow it seems that navigation does not have full backstack available thus it cannot find last destination on it and showing this ridiculous exception.

Also, in my app I have SplashScreen that is deciding which fragment to show next and after app being killed by system, Splash is not shown again and activity does not know where to go. (again - my guess)

This can be tested when you enable "Don't keep activities" in Developer Options. System can kill your app when it needs resources for other apps in use (eg. RAM).

I could not find some good solution and I had asked Google to help, but they seem to be too busy googling: https://issuetracker.google.com/issues/295991505 (no help at all)

I was trying:

  • safe navigation
  • different flags in navigation files
  • ...

So, this may not be an answer, but maybe it explains different sides of the problem. Maybe, someone else has the same issue and may help me too :(

This is especially dangerous if you have less than 92% of crash-free users - Play Store is displaying users that their phone may be incompatible and it does not let them install.

Upvotes: 0

Related Questions