Skip to content Skip to sidebar Skip to footer

You Must Call Setgraph() Before Calling Getgraph()

I have bottom Navigation also I'm replaced the tag with FragmentContainerView it gives me error about it does not have a NavController set on, then i was posted th

Solution 1:

This is fixed as per the 2.2.0-rc03 release notes:

NavHostFragment now correctly restores the graph after a configuration change when used with FragmentContainerView. (b/143752103)

So make sure you are using 2.2.0-rc03.

Solution 2:

You'll get this same error if you are like me and forget to add to your FragmentContainerView

app:navGraph="@navigation/nav_graph"app:defaultNavHost="true"

Solution 3:

use Navigation UI's latest vesion:

// navigation
implementation "androidx.navigation:navigation-fragment:2.3.0-alpha02"
implementation "androidx.navigation:navigation-ui:2.3.0-alpha02"

it fixed on new versions

Solution 4:

Follow this link to fix this issue https://developer.android.com/jetpack/androidx/releases/navigation In simpler terms upgrade your dependencies to the ones below in app module

defnav_version="2.3.0-alpha05"

// Java

implementation "androidx.navigation:navigation-fragment:$nav_version"
implementation "androidx.navigation:navigation-ui:$nav_version"

// Kotlin

implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"

// Dynamic Feature Module Support

implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version"

// Testing Navigation

androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"

in project module under dependencies if you are using safe args

  def nav_version = "2.3.0-alpha05"
    classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"

that fixed my issue..

Post a Comment for "You Must Call Setgraph() Before Calling Getgraph()"