简体   繁体   中英

Kotlin and Android Databinding

Updated 21.06.2015

I wanna try kotlin and android databinding in a same project. But when I add to kotlin-gradle-plugin dependency I cannot build even an empty project anymore with error:

cannot generate view binders 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. We'll remove kotlin dependency from the plugin on rc1 but until then you would need to use kotlin 0.11.91. Also, since kotlin's annotation processor support is limited at this moment and data binding is using annotation processor; they probably won't work well (though I have not tried).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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