I am trying to convert some part my code from java to kotlin. Currently, I am facing a problem. To scope a viewmodel to NavGrap im using
private val mPrintsViewModel : PrintsViewModel by navGraphViewModels(R.id.nav_print)
It compiles fine. But I get an error while running the app.
Unresolved reference: navGraphViewModels
I viewed several solutions like
- Add following lines to gradle
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
    
    apply plugin: 'kotlin-android'
    apply plugin: 'kotlin-android-extensions'
- Clear cache and restart 
- Verify if the IDE kotlin version matches with the project kotlin version. 
None of the above solutions work.
This issue happens for all kotlin extension functions.
I am using kotlin-1.4.10
Similar question : Question 1, Question 2
 
    