8

I am getting this error in view bindings file generated by Android studio. I have added

buildFeatures {
        viewBinding true
    }

to the app build.gradle file.

saurabh vaish
  • 123
  • 1
  • 1
  • 5
  • 1
    Does not have enough information to investigate the issue. It would be helpful if you can share the full error log? – saiful103a Jan 02 '21 at 18:35
  • i am getting only this much error. The file view bindings file which are generated when you compile the code are showing the android.view package does not exist. – saurabh vaish Jan 02 '21 at 18:37

3 Answers3

17

In your build.gradle(:app) file,

compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

Try changing the java version. I got the same error when using VERSION_11 but the VERSION_1_8 fixed the issue.

4

Android Studio don' t update Gradle to version 7. Open project Structure, you can find in File, set in Project: Android Gradle Plugin Version: 7.0.0 and Gradle Version: 7.0.2 Compile now and all will work fine.

mycky
  • 628
  • 10
  • 16
-3

Updating the android studio to the latest version fixed the issue for me.

saurabh vaish
  • 123
  • 1
  • 1
  • 5