Fragment Not Associated With A Fragment Manager

I found out that in my case the issue was related to threading. I solved it with:

 lifecycleScope.launchWhenResumed {
      findNavController().navigate(R.id.action_splashFragment_to_loginFragment)
 }

Would be good to know if this help you?!


Comment below code of yours

Handler().postDelayed({ 
   if (user == null) 
      findNavController().navigate(R.id.action_splashFragment_to_loginFragment) 
      //navigate to login screen if no user exists 
   else
      findNavController().navigate(R.id.action_splashFragment_to_businessListFragment) 
      //navigate to business list if user already logged in 
}, 2000)

If it works fine then

use Thread.sleep(5000) or IdlingResource to make a delay in your instrumentation test cases.

Root Cause: Actually, during your test case runtime, you are trying to operate upon the fragment which is waiting on Handler for 2000 millies to execute.