简体   繁体   English

Kotlin和Android数据绑定

[英]Kotlin and Android Databinding

Updated 21.06.2015 更新的2015年6月21日

I wanna try kotlin and android databinding in a same project. 我想在同一项目中尝试kotlin和android数据绑定。 But when I add to kotlin-gradle-plugin dependency I cannot build even an empty project anymore with error: 但是当我添加到kotlin-gradle-plugin依赖项时,即使出现错误,我也无法构建一个空项目:

cannot generate view binders java.lang.NoClassDefFoundError: kotlin/jvm/internal/ExtensionFunctionImpl 无法生成视图绑定程序java.lang.NoClassDefFoundError:kotlin / jvm / internal / ExtensionFunctionImpl

buildscript {
  repositories {
      jcenter()
  }
  dependencies {
      classpath 'com.android.tools.build:gradle:1.3.0-beta3'
      classpath "com.android.databinding:dataBinder:1.0-rc0"
      classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:0.12.613"
  }
}

Any workaroud to make it work together? 有什么工作技巧可以使其协同工作吗?

Unfortunately,this is caused by a kotlin version inconsistency between databinding and kotlin plugin. 不幸的是,这是由于数据绑定和kotlin插件之间的kotlin版本不一致引起的。 We'll remove kotlin dependency from the plugin on rc1 but until then you would need to use kotlin 0.11.91. 我们将从rc1上的插件中删除kotlin依赖关系,但在此之前,您将需要使用kotlin 0.11.91。 Also, since kotlin's annotation processor support is limited at this moment and data binding is using annotation processor; 另外,由于此时Kotlin的注释处理器支持受到限制,并且数据绑定正在使用注释处理器;因此, they probably won't work well (though I have not tried). 它们可能无法正常工作(尽管我没有尝试过)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM