Reputation: 53
Using Dagger2 and Kotlin, my component class implementations are not being generated when other calling code exists. When no calling code exists, the implementations are generated.
E.g.
val comp = DaggerMyComponent.create()
Causes the build to fail, DaggerMyComponent
is not generated and thus cannot be found
// val comp = DaggerMyComponent.create()
The DaggerMyComponent
class is generate and can be viewed on disk, the build succeeds.
I've tried Dagger 2.0.1, 2.0.2, 2.1-Snapshot, using Kotlin beta-1103. I can post my gradle file, source code, or stack trace if needed.
Has anyone encountered this issue before?
Upvotes: 5
Views: 1225
Reputation: 66
In your app's build file, make sure you added
kapt {
generateStubs = true
}
some example projects can be found here
https://github.com/damianpetla/kotlin-dagger-example/tree/master/app https://github.com/burntcookie90/KotlinDaggerDataBinding
Upvotes: 5