\"Android Studio\" shows error message \"Type parameter T has incompatible upper bounds: ViewDataBinding and ActivityChecklistsBinding.
ActivityChecklistsBindin
Add this is your build.gradle(Module:app) file
android {
dataBinding {
enabled true
}
}
I had the same problem. I tried a couple of things, Clean and Rebuild project.
But, It worked after I choose File -> Invalidate Caches / Restart
When I first meet this error, I create a layout named a.xml, and then I Create a Activity like this
public class ABinding extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ABinding binding = DataBindingUtil.setContentView(this, R.layout.a);
}
}
and this error occurs. Finally I found out Class ABinding was automatically generated in /build, so activity with name ABinding will overwrite the auto generated class
so I rename the Activity and the error disappear
add this in build.gradle
android{
....
dataBinding
{
enabled = true
}
...
}
If all the solutions mentioned above didn't work out go to your .gradle folder > caches and delete all folders with name starting with transforms i.e. transforms-1 & transforms-2. This works for me
You should use ActivityMainBinding in place of your Activity class name.
ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_checklists);