5

enter image description here

I am getting this error in Kotlin, even when I have set viewBinding true in gradle file of app, Please help Cannot access 'androidx.viewbinding.ViewBinding' which is a supertype of 'com.example.cpapp.databinding.ActivityMainBinding'. Check your module classpath for missing or conflicting dependancies

3
  • can you share your build.gradle file class. Commented Feb 16, 2022 at 9:53
  • And please follow this link stackoverflow.com/questions/61775091/… this may help. Commented Feb 16, 2022 at 9:54
  • 2
    I encountered this issue in AndroidStudio Chipmunk 2021.2.1 Patch 1. For me the issue got fixed by inValidating the caches, i.e, File > Invalidate Caches > Checked both [(FileSystem & LocalHistory), (VCS log & Indexes)] > Invalidate & restart. Commented Aug 6, 2022 at 9:09

8 Answers 8

4

it was solved just restarted my laptop and I had an update for one of the dependancies. Thanks alot for the help.

Sign up to request clarification or add additional context in comments.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
4

In gradle.properties writing android.enableJetifier = true worked for me.

Comments

4

Add this library in app-level dependency:

implementation 'com.android.databinding:viewbinding:7.2.2'

It worked for me. thanks.

1 Comment

This should be the correct answer. Is the only one that really fixed the binding missing error
3

Just in "Build.gradle(app)" once set viewBinding = false and again set viewBinding = true

Comments

1

Got the same error while migrating from kotlin synthetics to viewbinding. Cleaning the project fixed it.

Comments

0

if you are using Android Studio 3.6.

android {
viewBinding {
    enabled = true
}}

or if you are using Android Studio 4.0, viewBinding has been moved into buildFeatures

android {
buildFeatures {
    viewBinding = true
}}

after that try to rebuild your project so that the binding class can be generated

then it should work properly

some times android studio gets crazy with bindings so try to invalidate cache and restart too.

Comments

0

Add following in app-level dependency:

android {
    ...
    dataBinding {
        enabled true
    }
}

It worked for me. Good luck...

Comments

0

And also restart Android Studio to invalidate caches. It worked for me.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.