using Kotlin 1.20.20 (not that it matters, older versions behaves the same)
When layout is in separate library module Android Studio has no problem finding and refer
None of the above answers actually helped me . Add both these plugins in your library module's build.gradle file on top :
apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-android'
This should solve the issue .