damianpetla / kotlin-dagger-example

Example of Android project showing integration with Kotlin and Dagger 2
535 stars 57 forks source link

Move all classes to Kotlin #4

Closed mzgreen closed 9 years ago

mzgreen commented 9 years ago

Is it already possible to move all the code to Kotlin?

Here is a sample from JetBrains https://github.com/JetBrains/kotlin-examples/tree/master/gradle/kotlin-dagger and only one class is in java. That class uses code that should be generated by Dagger. Unfortunately if I rewrite it to Kotlin then Dagger is not generating anything. According to this blog post http://blog.jetbrains.com/kotlin/2015/06/better-annotation-processing-supporting-stubs-in-kapt/ it should work now. Am I missing something?

I have tried to use 0.1-SNAPSHOT version of Kotlin as well as the newest 1.0 beta and result is the same.

mzgreen commented 9 years ago

I have found a solution. You have to add

kapt { generateStubs = true }

In your build.gradle file and it will work with all the codr written in Kotlin :)

damianpetla commented 9 years ago

done