Dagger/MissingBinding java.util.Map,Provider> cannot be provided without an @Provides-annotated method

前端 未结 3 1696
盖世英雄少女心
盖世英雄少女心 2020-12-04 02:31

This is how I\'m trying to provide my ViewModelFactory:

@Suppress(\"UNCHECKED_CAST\")
@Singleton
class ViewModelFactory @Inject constructor(
            


        
3条回答
  •  猫巷女王i
    2020-12-04 03:01

    I faced the same issue recently. Version Kotlin:1.3.40 Dagger:2.23.2 I tried following the solutions mentioned in this post and here

    but none seemed to work. The annotation processor of Dagger is not playing well with KAPT and for the same reason, the builds are failing. This is also updated on Kotlin issue too.

    For me, converting both the ViewModelKey and ViewModelFactory to java worked. For Dagger, the tracking issue can be found here.

    Update Adding @JvmSuppressWildcards fixed the issue. Code looks like this:

    private val providers: Map, @JvmSuppressWildcards Provider>
    

提交回复
热议问题