Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Databinding compiles but shows error in Android Studio 3.6

Since the new Android Studio 3.6 update, my databinding classes show "Cannot resolve symbol"

The code itself is completely fine and it even compiles successfully, but everywhere I'm calling the binding classes, Android Studio gives me the "Cannot resolve symbol" error. This goes through every class or xml I'm using databinding in.

Did anyone of you experience the same? It seems weird, that the update to 3.6 did that. Gradle version used is 3.6.1

Thank you!

Edit: I for now have taken every step I can as a developer, reconfigured everything, tried on different machines etc. I'm not sure if this is a problem of the project I'm working on or a bug of 3.6 that only occurs when some criterias are met, since I'm not the only one, having this exact problem. Below is a screenshot of it to give you an idea how it looks.

Screenshot of the Problem

Final Edit

Seems like upgrading to the Android Studio 4.0 Beta 1 fixed the problem for me now. This seems to be an Android Studio 3.6 related issue. Don't know if using a beta version is a possible solution for you, but for me this solved it completely

like image 399
Bjonic Avatar asked Mar 03 '20 10:03

Bjonic


People also ask

Which is better ViewBinding and DataBinding?

ViewBinding vs DataBindingThe main advantages of viewbinding are speed and efficiency. It has a shorter build time because it avoids the overhead and performance issues associated with DataBinding due to annotation processors affecting DataBinding's build time.

Can we use ViewBinding and DataBinding together?

You can't use them togheter in the same layout. ViewBinding is a subset of what DataBinding can do and should be used if you want to replace libraries like ButterKnife , KotterKnife or KAE (Kotlin Android Extensions) but don't want to invest in databinding refactoring.

What is the use of DataBinding in Android?

The Data Binding Library is a support library that allows you to bind UI components in your layouts to data sources in your app using a declarative format rather than programmatically.


1 Answers

Seems like upgrading to the Android Studio 4.0 Beta 1 fixed the problem for me now. This seems to be an Android Studio 3.6 related issue. Don't know if using a beta version is a possible solution for you, but for me this solved it completely

like image 129
Bjonic Avatar answered Nov 08 '22 22:11

Bjonic