error: package android.view does not exist
Asked Answered
B

3

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.

Banna answered 2/1, 2021 at 18:31 Comment(2)
Does not have enough information to investigate the issue. It would be helpful if you can share the full error log?Mra
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.Banna
B
-3

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

Banna answered 4/1, 2021 at 6:31 Comment(0)
L
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.

Ladino answered 16/5, 2021 at 17:58 Comment(1)
what if someone must use JDK11 for other dependency issues?Carrnan
T
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.

Tophole answered 16/8, 2021 at 11:16 Comment(0)
B
-3

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

Banna answered 4/1, 2021 at 6:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.