在Android Studio中添加数据绑定后的编译问题

时间:2018-12-12 21:22:23

标签: android android-studio kotlin dependencies android-databinding

当我尝试使用dataBinding ressouce编译我的Android项目时,收到此错误消息

w: warning: The following options were not recognized by any processor: 
'[android.databinding.artifactType, android.databinding.printEncodedErrors, 
android.databinding.minApi, android.databinding.isTestVariant, 
android.databinding.enableDebugLogs, android.databinding.sdkDir, 
android.databinding.bindingBuildFolder, android.databinding.enableForTests, 
android.databinding.modulePackage, kapt.kotlin.generated, 
android.databinding.generationalFileOutDir, android.databinding.xmlOutDir]'

在应用程序build.gradle中:

android {
    dataBinding{
        enabled=true
}

1 个答案:

答案 0 :(得分:0)

如果您将数据与Kotlin结合使用,则需要在build.gradle

中添加它
apply plugin: 'kotlin-kapt'

dependencies {
    kapt "com.android.databinding:compiler:3.2.1" // this version must like com.android.tools.build:gradle version
}