When I build the project. I'm getting error on app:visibleGone
I'm also enable true to dataBinding in build.gradle and using android architecture components and mvvm.
project targetSdkVersion
is 26
and support lib version is 26.0.1
.
Below is the error message
error: package com.****.****.databinding does not exist
error: cannot find symbol class ActivityMainBinding
Cannot find the setter for attribute 'app:visibleGone' with parameter type boolean on android.widget.Button.
here is my activity_main.xml
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="loading"
type="boolean" />
</data>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.aungmyolwin.importdb.MainActivity">
<Button
android:id="@+id/btn_load_sql"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Load from SQL"
app:visibleGone="@{!loading}"/>
<Button
android:id="@+id/btn_load_room"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Load from Room mapper"
app:visibleGone="@{!loading}"/>
<TextView
android:id="@+id/tv_import_loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Importing database...."
app:visibleGone="@{loading}"/>
</LinearLayout>
</layout>
ActivityMain.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
binding.btnLoadRoom.setOnClickListener(this);
binding.btnLoadSql.setOnClickListener(this);
viewModels= ViewModelProviders.of(this).get(MainActivityViewModels.class);
}
}