Kotlin and Android Databinding

2.3k Views Asked by At

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?

1

There are 1 best solutions below

4
On BEST ANSWER

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).