Kotlin-android: unresolved reference databinding

后端 未结 16 1019
借酒劲吻你
借酒劲吻你 2020-12-02 16:23

I have following fragment class written in Java using the new databinding library

import com.example.app.databinding.FragmentDataBdinding;

public class Data         


        
16条回答
  •  自闭症患者
    2020-12-02 16:46

    The version of Data Binding compiler is same as gradle version in your project build.gradle file:

    // at the top of file 
    apply plugin: 'kotlin-kapt'
    
    
    android {
      dataBinding.enabled = true
    }
    
    dependencies {
      kapt "com.android.databinding:compiler:3.0.0-beta1"
    }
    

    and the gradle version is

    classpath 'com.android.tools.build:gradle:3.0.0-beta1'
    

    Here is an example link to complete using of databinding library in kotlin.

    https://proandroiddev.com/modern-android-development-with-kotlin-september-2017-part-1-f976483f7bd6

提交回复
热议问题