What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
android.databinding.tool.util.LoggedErrorException: Found data binding errors.
/ data binding error msg:The expression userInfo.userName() cannot be inverted: Two-way binding cannot resolve a setter for java.lang.String property 'userName'
loc:48:37 - 48:53
\ data binding error
@AutoValue
public abstract class UserInfo {
public abstract String avatar();
@SerializedName("username")
public abstract String userName();
@SerializedName("realname")
public abstract String realName();
public static TypeAdapter<UserInfo> typeAdapter(Gson gson) {
return new AutoValue_UserInfo.GsonTypeAdapter(gson);
}
}
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<import type="com..model.UserInfo"/>
<variable name="userInfo" type="UserInfo"/>
</data>
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/white">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/titleColor"
android:textSize="24sp"
android:text="@={userInfo.userName}"/>
</LinearLayout>
</ScrollView>
</layout>
can you give som help?