Dagger 2 error with kotlin missing provider

I am trying to fix bug when using new androidx with Dagger and kotlin. It works fine when using in Java written. But, when I switch it to kotlin,

I got error: error: java.util.Map,javax.inject.Provider>> cannot be provided without an @Provides-annotated method. I am using Android Studio 3.2.1

Here is my code:

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

apply plugin: 'kotlin-kapt'

implementation "com.google.dagger:dagger:2.13"

implementation "com.google.dagger:dagger-android:2.13"

implementation "com.google.dagger:dagger-android-support:2.13"

kapt "com.google.dagger:dagger-compiler:2.13"

kapt "com.google.dagger:dagger-android-processor:2.13"

My AppComponent:

@Singleton

@Component(modules = [AppModule::class, BuildersModule::class, NetworkModule::class])

interface AppComponent {

@Component.Builder

interface Builder {

@BindsInstance

fun application(app: BaseApp): Builder

fun build(): AppComponent

}

fun inject(app: BaseApp)

}

And my AppModule:

@Module

class AppModule {

@Provides

@Singleton

internal fun provideDataManager(): DataManager {

return DataManager()

}

@Provides

fun provideContext(app: BaseApp)...

Read More »

By: StackOverFlow - Thursday, 8 November

Related Posts