I'm now using viewBinding with Kotlin.
here is my build.gradle
enable ViewBinding and has auto import ViewBinding dependency.
but Android Studio still shows error like this
but I can build and run with no problem.
and if I add viewBinding in dependencies, then the error is gone.
Does anyone know why?
UPDATE:
I know why. I'm using AndroidX, and the IDE says can not access 'android.viewbinding.ViewBinding', but my dependency is AndroidX, it is 'androidx.viewbinding.ViewBinding', package name changed.
SOLUTION: add android.useAndroidX=true to project gradle.properties file.
global gradle.properties setting does not work, don't know why.
Facing same issue exact error yesterday. Solution work for me is
and Error is gone
Making sure
buildFeatures { viewBinding true }