I'm trying out a new architecture with multi-module and DI though Hilt, I have the following modules:
- app: Contains MainActivity (which does nothing except holding fragment)
- featureHome: Contains HomeFragment and HomeViewModel
When I start the app I'm getting java.lang.RuntimeException: Cannot create an instance of class HomeViewModel
App module
@AndroidEntryPoint
class MainActivity: AppCompatActivity()
FeatureHome
class HomeFragment: Fragment() {
private val viewModel: HomeViewModel by viewModels()
...
}
@HiltViewModel
class HomeViewModel @Inject constructor(): ViewModel {
....
}
I'm not sure what to do to resolve this. Should my HomeFragment also have @AndroidEntryPoint
?