Generated classes not found

Using Dagger2 and Kotlin, my component class implementations are not generated when another call code exists. If the call code does not exist, implementations are generated.

eg.

val comp = DaggerMyComponent.create() 

Causes assembly failures, DaggerMyComponent not generated and therefore cannot be found

 // val comp = DaggerMyComponent.create() 

The DaggerMyComponent class DaggerMyComponent generated and can be viewed on disk, assembly completed successfully.

I tried Dagger 2.0.1, 2.0.2, 2.1-Snapshot using Kotlin beta-1103. I can publish my gradle file, source code or stack trace if necessary.

Has anyone encountered this problem before?

+5
source share
1 answer

In your application build file, make sure you add

 kapt { generateStubs = true } 

some sample projects can be found here

https://github.com/damianpetla/kotlin-dagger-example/tree/master/app https://github.com/burntcookie90/KotlinDaggerDataBinding

+5
source

Source: https://habr.com/ru/post/1235746/


All Articles