I have a fragment:
class PingFragment : Fragment(), ViewRenderer<StartingState> {
private val viewModel: PingFragmentViewModel by viewModels()
A ViewModel :
class PingFragmentViewModel @ViewModelInject constructor(private var pingRepository: PingRepository) : ViewModel() {
A repository:
@Module
@InstallIn(ActivityComponent::class)
class PingRepository @Inject constructor(@ActivityContext var context: Context) {
When I Start my Application, I have this error:
Caused by: java.lang.InstantiationException: java.lang.Class<com.ping.android.fragment.PingFragmentViewModel> has no zero argument constructor
WHat I can do to tell at Hilt to pass my repo as argument to my VM ?
You forgot to add
@AndroidEntryPoint
to your fragment class