I have following fragment class written in Java using the new databinding library
import com.example.app.databinding.FragmentDataBdinding;
public class Data
You can see in documentation of Android.
The new compiler in version 3.2 is enabled by default.
So Just Update your Android Studio to V3.2 or newer. and remove all unnecessary config.
build.gradle.android {
dataBinding {
enabled = true
}
}
It will do all things for you automatically.
Remove databinding.compiler
kapt 'com.android.databinding:compiler:3.0.1'
Remove kapt
kapt {
generateStubs = true
}
build.gradle (Project)
kotlin_version = '1.2.71'
classpath 'com.android.tools.build:gradle:3.2.0'
Use gradle latest version. Use kotlin latest version.
build.gradle (App)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
compileSdkVersion 28
targetSdkVersion 28
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
Important Do not just copy and paste config. See this answer for setting up Kotlin version.
gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip