It is working fine as long as I am using the data model with two fields.
But when I am trying to use kotlin. Pair it is failing to build and giving nit informative error :
....\DataBinderMapperImpl.java:20: error: cannot find symbol
import .....databinding.ItemCurrencyBindingImpl;
symbol: class ItemCurrencyBindingImpl
location: package ......databinding
Xml code :
<variable
name="currency"
type="kotlin.Pair"/>
</data>
<TextView
android:layout_width="@dimen/currency_dropdown_width"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center|start"
android:padding="@dimen/currency_dropdown_padding"
android:text="@{currency.first}"
app:drawableEnd="@{currency.second}"
app:drawableSize="@{@dimen/currency_dropdown_image_size}"
tools:text="@string/pound"/></layout>
You need to add the import of the type pair to your data section, and also declare the type of the elements of the pair.
If you currency type is Pair<String, Int> you can declare it like this:
<import type="kotlin.Pair"/>
<variable name="currency" type="Pair<String, Int>"/>