https://kotlinlang.org logo
#android
Title
# android
m

mattinger

06/01/2017, 7:18 PM
I setup the following in my app's build.gradle file:
Copy code
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
dependencies {
  kapt "com.google.dagger:dagger-compiler:2.1"
  kapt "com.android.databinding:compiler:$androidGradlePluginVersion"
  kapt "me.tatarka:gradle-retrolambda:3.6.0"
}
kapt {
  generateStubs = true
}
t

trevjones

06/01/2017, 9:57 PM
mattinger: try removing
apply plugin: 'kotlin-kapt'
m

mattinger

06/02/2017, 12:34 AM
@trevjones doing that stops the databinding compiler from running altogether, so java files don't compile either.
s

stepango

06/02/2017, 2:27 AM
first of all remove
Copy code
kapt {
  generateStubs = true
}
it's not needed for kapt 3 AFAIK kotlin does not work with retrolambda
m

mattinger

06/02/2017, 3:23 AM
i agree kotlin does not need retrolambda, but my java code needs it. It seems that i was actually chasing a ghost.
seems that the java -> kotlin converter did this for me:
@Inject private SettingsManager settingsManager
-->
@Inject internal var settingsManager: SettingsManager? = null
that's the actual problem.
I changed it to:
lateinit var settingsManager: SettingsManager
and it works.
i also changed the reference to my binding object to be a lateinit as well for good measure.