Dagger Error: "Prefer to run the dagger processor over that class instead" in Kotlin
Hello everyone! I'm migrating a project from Java to Kotlin and encountered an issue when using Dagger 2. I have a simple module that provides a dependency:
```kotlin
@Module
class NetworkModule {
@Provides
@Singleton
fun provideRetrofit(): Retrofit {
return Retrofit.Builder()
.baseUrl("https://api.example.com")
.build()
}
}
@Component(modules = [NetworkModule::class])
@Singleton
interface AppComponent {
fun inject(activity: MainActivity)
}
```
But when I run the build, Gradle gives this error:
`error: [Dagger/DependencyCycle] Prefer to run the dagger processor over that class instead`
I googled it, but all solutions are either for Java or don't work. I'm using Kotlin 1.8, Dagger 2.48, kapt. I tried clean
No answers yet.
Log in to leave an answer
Blogs