[SOLVED] MainActivityBinding file not being generated in Android Studio


This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under
CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

Issue

I am trying to get databinding functionality implemented in code. In build.gradle I am adding databinding.enabled=true but it is giving error cannot resolve symbol enabled. How can this be corrected?

Solution

Well for the data binding enabled projects the Binding classes will be auto generated with name as LayoutNameBinding

But for most of the case the binding name for MainActivity will generated with same name creation logic, ie ActivityMainBinding since the layout name be activity_main.xml

ie the Layout name. eg if the layout name is custom_layout.xml, then the binding class name will be CustomLayoutBinding

Happy coding.. 🙂

Answered By – Sanoop Surendran

people found this article helpful. What about you?