Android ViewModel has no zero argument constructor

In my case as I’m using HILT, it was lacking one annotation above the Fragment that has a ViewModel: @AndroidEntryPoint

class BestFragment : Fragment() { 

Of course in your ViewModel class you also need to Annotate with
what HILT needs: @ViewModelInject

class BestFragmentViewModel @ViewModelInject constructor(var userManager: UserManager) : ViewModel() {

Leave a Comment