Avoiding Android navigation IllegalArgumentException in NavController : <p>I recently switched over to Android Navigation, but have encountered a fair amount of situations (in different parts of the code), where I get:</p>

<pre><code>Fatal Exception: java.lang.IllegalArgumentException
navigation destination com.xxx.yyy:id/action_aFragment_to_bFragment is unknown to this NavController
</code></pre>

<p>In every case, the code are simple calls like:</p>

<pre><code>findNavController(this, R.id.navigation_host_fragment).navigate(R.id.action_aFragment_to_bFragment)
</code></pre>

<p>Usually in response to a button press.</p>

<p>It's unclear why this error is getting thrown. My current suspicion is that the onClickListener is somehow getting called twice on some devices, causing the navigate to be called a second time (causing it to be in the wrong state at the time). The reason for this suspicion is that this most often seems to happen in cases where one might have a "long" running operation before the navigate call. I can't recreate this on my own device, though.</p>

<p>Ideas on how to avoid this issue (or indeed, what the actual root cause of the issue is)?</p>

<p>I don't want to use Global Actions; I'm wary of introducing even more unexpected states to the backstack. And I'd really prefer not to have to try and test for the currentstate every time a navigate call is made.</p>
