Kotlin-android: unresolved reference databinding

后端 未结 16 1117
借酒劲吻你
借酒劲吻你 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:39

    To Solve the problem, you have to put

    apply plugin: 'kotlin-kapt'
    

    at the top of build.gradle (Module: app), then put this line in dependencies

    kapt "com.android.databinding:compiler:[YOUR_ANDROID_PLUGIN_VERSION]"
    

    You can find android plugin version by go to menu

    File > Project Structure > Project
    

    Then Sync Again. If you see this warning, ignore it.

    3rd-party Gradle plug-ins may be the cause

提交回复
热议问题