I use navigation library and safeargs for passing data. I define argument to fragment like that.
In my case, the missing part was firstly in the build.gradle.kts
buildscript {
repositories {
google()
}
dependencies {
def nav_version = "X.X.X" // Use the latest version
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
}
}
and then, I had to add the plugin in app and navigation modules (I usually separate navigation in a different one):
apply plugin: "androidx.navigation.safeargs.kotlin"
Clean -> Build But still had to add manually the path to the action
import yourpackage.FragmentDirections.Companion.actionFirstFragmentToSecondFragment