Unresolved reference: NavArgs after added some arguments to destination
In my case i typed the argument Name starting by a capital letter
<argument
android:name="MyArgument" // changed it to myArgument fix the problem
app:argType="string"
app:nullable="false" />
i had the same problem and i solved this by doing following steps
Build -> Clean Project
- delete argument from
nav_graph.xml
file - create new argument
Build -> Rebuild Project
- set the argument
val action: NavDirections = AreThereAnyDecayedTeethInTheAreaOfPainFragmentDirections
.actionAreThereAnyDecayedTeethInTheAreaOfPainFragmentToResultFragment(
finalresult = "somethings"
)
- use this argument on FragmentDest
arguments.let {
binding.board.text = ResultFragmentArgs.fromBundle(it!!).finalresult
}
As per the documentation on that very page:
When using the
-ktx
dependencies, Kotlin users can also use the by navArgs() property delegate to access arguments.
Make sure you are following the Adding Components documentation and using the navigation-fragment-ktx
dependency:
implementation "android.arch.navigation:navigation-fragment-ktx:1.0.0-alpha11"