AndroidViewModel has no zero argument constructor
if you're using hilt
, you probably forgot to annotate your activity with @AndroidEntryPoint
apparently if I change
recipeViewModel = new ViewModelProvider(this).get(RecipeViewModel.class);
to this
recipeViewModel = new ViewModelProvider(this, ViewModelProvider.AndroidViewModelFactory.getInstance(this.getApplication())).get(RecipeViewModel.class);
It works. I don't know why this solution works could someone explain?