Data binding generic variable
You have a left triangle bracket in XML; XML don't play that way. try
<data>
<variable
name="viewModel"
type="com.example.viewmodel.ViewModel<Model>"/>
</data>
Try this one:
<data>
<variable
name="viewModel"
type="com.example.viewmodel.ViewModel<Model>"/>
</data>
<
is responsible for < and >
is responsible for >.
You can set something like examples above:
<data>
<import type="com.example.path.Model"/>
<variable
name="obj"
type="com.example.viewmodel.ViewModel<Model>"
/>
</data>
NOTE: you can write '>' or '>
' at end of Model should be OK
To avoid error display do not forget to add line to tell what object type is used:
<import type="com.example.path.Model"/>
You need to escape <Model> as shown below:
<data>
<variable
name="viewModel"
type="com.example.viewmodel.ViewModel<Model>"/>
</data>
Android Studio will still show a "Cannot resolve symbol" error, but the XML will compile. It is a known issue. From Android Studio Support for Data Binding:
Note: Arrays and generic types, such as the Observable class, might display errors when there are no errors.