Classifier does not have a companion object, and thus must be initialized here Classifier does not have a companion object, and thus must be initialized here android android

Classifier does not have a companion object, and thus must be initialized here


This line selection=RowSubTShirtViewModel references the view model as if it were a named object, meaning you would have written instead of class object:

object RowSubTShirtViewModel {   //...}

However, since that's not the case, kotlin is telling you that you cannot reference it like that and must initialize it. The constructor as quite a lot of parameters for me to guess what they are, but essentially you'd have to pass them in:

selection=RowSubTShirtViewModel(/*parameters here*/)


in my case, I got this error in ApplicationModule for dagger2.

@Provides@Singleton internal fun providesxx(xx: xxx): xx {        return xx    }

I just Rename the argument!