question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NavigationBasicSample crash when `navigate` after `popupTo`

See original GitHub issue

I build NavigationBasicSample on Pixel XL 2 emulator API 28.

Step1: Match navigate action_match_to_in_game Step2: InGame navigate action_in_game_to_gameOver Step3: Back press to Match Step4: Match navigate action_match_to_in_game crash

Note: if in Step3 we press [Try Again?] to use popupTo, the app has no crash.

08-02 11:34:53.842 2885-2885/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.android.navigationsample, PID: 2885
    java.lang.IllegalArgumentException: navigation destination com.example.android.navigationsample:id/action_match_to_in_game is unknown to this NavController
        at androidx.navigation.NavController.navigate(NavController.java:669)
        at androidx.navigation.NavController.navigate(NavController.java:628)
        at androidx.navigation.NavController.navigate(NavController.java:616)
        at com.example.android.navigationsample.Match$onCreateView$1.onClick(Match.kt:36)
        at android.view.View.performClick(View.java:6597)
        at android.view.View.performClickInternal(View.java:6574)
        at android.view.View.access$3100(View.java:778)
        at android.view.View$PerformClick.run(View.java:25885)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13

github_iconTop GitHub Comments

6reactions
enekonietocommented, Aug 6, 2018

I had similar problem with my own code. It was caused by version 1.0.0-alpha04 of Navigation component, it was fixed when using 1.0.0-alpha03.

3reactions
gilgoldzweigcommented, Oct 14, 2018

bug returns on 1.0.0-alpha06 ktx

java.lang.IllegalArgumentException: navigation destination com.nyx.tech.dev:id/action_home_fragment_to_calibration_fragment is unknown to this NavController
        at androidx.navigation.NavController.navigate(NavController.java:691)
        at androidx.navigation.NavController.navigate(NavController.java:648)
        at androidx.navigation.NavController.navigate(NavController.java:634)
        at androidx.navigation.NavController.navigate(NavController.java:712)
        at com.nyx.tech.fragments.home.HomeFragment.onFeatureInitiated(HomeFragment.kt:240)
        at com.nyx.tech.fragments.home.HomeFragmentPresenter$observe$1.onChanged(HomeFragmentPresenter.kt:177)
        at com.nyx.tech.fragments.home.HomeFragmentPresenter$observe$1.onChanged(HomeFragmentPresenter.kt:50)
        at android.arch.lifecycle.LiveData.considerNotify(LiveData.java:109)
        at android.arch.lifecycle.LiveData.dispatchingValue(LiveData.java:126)
        at android.arch.lifecycle.LiveData.setValue(LiveData.java:282)
        at android.arch.lifecycle.MutableLiveData.setValue(MutableLiveData.java:33)
        at android.arch.lifecycle.LiveData$1.run(LiveData.java:87)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:148)
        at android.app.ActivityThread.main(ActivityThread.java:5417)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
10-14 15:23:52.527 23366-23427/com.nyx.tech.dev W/NYXApplication$onCreate: com
Read more comments on GitHub >

github_iconTop Results From Across the Web

Android navigation component with bottom ...
I have a main nav graph with included subgraphs to provide multiple back stacks with bottom navigation view.
Read more >
Global actions
To create a global action, do the following: ... Click the Text tab to navigate to the XML text view. The XML for...
Read more >
Wrong animation applied when navigating using `popUpTo`
Hello, I'm experiencing a issue and I don't know if it's a bug in the navigation component or I just misunderstand it. I...
Read more >
The recommended substitute for clearTask of popUpTo with ...
After it was deprecated I decided to try the recommended approach of instead setting ... https://github.com/hsson/android-navigation-component-alpha06-bug
Read more >
Jetpack Navigation Component in One Video - YouTube
Android Jetpack and architecture courses: https://codingwithmitch.com/courses/In this video I show you everything you need to know to get ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found