I am using Android Studio 2.0 Preview 4. I\'m using Android SDK tools 25 rc1. This error persists no matter how many times I clean / rebuild project. File->Invalidate Caches
Do this
ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
Instead of
MainActivity binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
I was getting this error because i missed the tag in view xml, which is not the case here.
If your gradle version is ok (1.5+) then you should try this:
This might fix the problem. Let us know.
There is a simple solution.
Hope this answer will help you.
The refresh is of no use if it continues to give errors. When there are these errors it is likely that in your xml file there is a problem that the compiler did not show you when creating the layout. In fact, it may happen that this error is visible only in its "debug" folder. If an error of this type should occur, just follow the error in the debug folder and correct it from the original file. In my case the error was two duplicates of
xmlns: app = "http://schemas.android.com/apk/res-auto"
that I couldn't see
I just thought based on Felipe Gualberto's Answer and I got solution difference way.
If you have written multiple views with the same id in different XML then make it unique.
Thank you.