I have following fragment class written in Java using the new databinding library
import com.example.app.databinding.FragmentDataBdinding;
public class Data
In my case, adding
kapt {
generateStubs = true
}
Solved the problem for me. I ignored it the first time, I thought it's irrelevant to the problem:
Unresolved reference databinding
But now, data-binding is working just fine.
this work for me in androidStudio ver3.1.3
apply plugin: 'kotlin-kapt'
dataBinding {
enabled = true
}
It works with 1.0-rc4, put
kapt 'com.android.databinding:compiler:1.0-rc4'
into your dependencies
Thanks Ghedeon, for the link in comments
Update: Here's a really simple hello world example project
I want to share my own expirience. To use data databinding with Kotlin in android studio is enough to add
dataBinding {
enabled = true
}
After that "sync it" and, it's very important, to "make Project". After that all your object will be active to use.