https://kotlinlang.org logo
#dagger
Title
# dagger
c

Colton Idle

02/16/2022, 2:43 AM
Stumbling on how to get this working correctly with dagger2 + kotlin
Copy code
@Provides
fun provideApiService( <========== ERROR: error: [Dagger/MissingBinding] okhttp3.Interceptor cannot be provided without an @Provides-annotated method.
    @Named("application_interceptors") applicationInterceptors: MutableList<Interceptor>,
    @Named("network_interceptors") networkInterceptors:  MutableList<Interceptor>,
Providers:
Copy code
@Provides
@Named("application_interceptors")
fun provideApplicationInterceptorList(
    @ApplicationContext context: Context,
): MutableList<Interceptor> {
and
Copy code
@Provides
@Named("network_interceptors")
fun provideNetworkInterceptorList(
    @ApplicationContext context: Context,
): MutableList<Interceptor> {
a

Arun

02/16/2022, 2:46 AM
Probably need to use @JvmSuppressWildcards Try this instead MutableList<@JvmSuppressWildcards Interceptor>
c

Colton Idle

02/16/2022, 2:48 AM
Same issue. error: [Dagger/MissingBinding] okhttp3.Interceptor cannot be provided without an @Provides-annotated method.
f

FunkyMuse

02/16/2022, 7:15 AM
You can't provide MutableList, you can only do Set, List, Map (immutables)
c

Colton Idle

02/17/2022, 12:35 AM
This seems to work. Thank you
@JvmSuppressWildcards List<Interceptor>
205 Views