You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While trying to build with the MVVM arch with ViewModelFactory using dagger multibinding, the build fails:
error: [Dagger/MissingBinding] java.util.Map<java.lang.Class<? extends androidx.lifecycle.ViewModel>,? extends javax.inject.Provider<androidx.lifecycle.ViewModel>> cannot be provided without an @Provides-annotated method.
public abstract interface AppComponent {
java.util.Map<java.lang.Class<? extends androidx.lifecycle.ViewModel>,? extends javax.inject.Provider<androidx.lifecycle.ViewModel>> is injected at
In fact, I tried following the solutions mentioned here #1478 by moving the ViewModelKey to java but it didn't work. Other fixes like downgrading versions also did not work. Also, pls note that I am using the latest versions of Kotlin and Dagger. Pls help if I am missing something @ronshapiro
The text was updated successfully, but these errors were encountered:
Update
Converting both ViewModelKey and ViewModelFactory to java solved the problem. That means, the problem either exists with Dagger Annotation processing or KAPT
Update 2: Looks like this was a typical problem of declaration-site variance from Kotlin to Java conversion. Adding @JvmSuppressWildcards solved the problem. private val providers: Map<Class<out ViewModel>, @JvmSuppressWildcards Provider<ViewModel>>
While trying to build with the MVVM arch with
ViewModelFactory
using dagger multibinding, the build fails:The
ViewModelKey
used :Versions
Dagger:2.23.2
Kotlin:1.3.40
In fact, I tried following the solutions mentioned here #1478 by moving the ViewModelKey to java but it didn't work. Other fixes like downgrading versions also did not work. Also, pls note that I am using the latest versions of Kotlin and Dagger. Pls help if I am missing something
@ronshapiro
The text was updated successfully, but these errors were encountered: