kotlin を使用して開発された Android プロジェクトで DataBinding を有効にする手順は次のとおりです。
1. アプリの build.gradle の Android 構成項目の下に以下を追加します。
dataBinding{
enabled = true
}
2. アプリの build.gradle に以下を導入します。
apply plugin: 'kotlin-kapt'
3. 依存関係を追加します。
kapt 'com.android.databinding:compiler:$version'
4. コンパイル中に次のエラーが発生した場合:
[kapt] Incremental annotation processing requested, but support is disabled because the following processors are not incremental:
android.databinding.compiler.Processor (NON_INCREMENTAL),
android.databinding.compiler.xxxxx (NON_INCREMENTAL).
Android設定項目の下に追加してください
kapt {
generateStubs = true
}