I use navigation library and safeargs for passing data. I define argument to fragment like that.
I faced a similar issue working with android studio 4.2 preview.
The issue was that the IDE somehow was not picking the source folders where the generated direction classes where being placed by the plugin. So adding the following to my app build.gradle file resolved the issue for me.
sourceSets {
main {
java {
srcDirs += 'build/generated/source/navigation-args'
}
}
}
Hope this helps!