0

I am coming from reading all the answers in IllegalArgumentException: navigation destination xxx is unknown to this NavController with no luck. I am getting this when the activity is recreated from either a manual recreate() call or coming back from a process death.

I have an Activity that changes its Fragments using Navigation. Fragment A has a FAB that navigates to Fragment B when clicked.

   floatingActionButton = view.findViewById<FloatingActionButton>(R.id.floating_action_button).apply {
       setOnClickListener {
           findNavController().navigate(R.id.action_fragmentA_to_fragmentB,
              null,
              null,
              FragmentNavigatorExtras(this to "shared_element_container"))
       }
   }

Works fine but when the FAB is clicked after the activity is recreated I get a crash.

nicoqueijo
  • 872
  • 2
  • 11
  • 28

1 Answers1

0

Turns out I had accidentally given the same id to a nested graph and a fragment.

nicoqueijo
  • 872
  • 2
  • 11
  • 28