kotlin + Dagger2 : cannot be provided without an @Provides-annotated method

In my case, I forgot to include @Module(includes = [ViewModelModule::class]) in class AppModule


I was just missing to add @JvmSuppressWildcards before Provider<ViewModel>

@Singleton
class KotlinViewModelFactory @Inject constructor(private val creators: Map<Class<out ViewModel>, @JvmSuppressWildcards Provider<ViewModel>>) : ViewModelProvider.Factory {
    ...
}

May God help all of us with Kotlin + Dagger :)

I wrote an article to solve this maze of Dagger, so as to make developers life easy:

https://medium.com/simform-engineering/stabbing-the-dagger-in-kotlin-merely-in-4-mins-977dba02fade