Hi, I am getting the dreaded *`java.lang.Class<...
# compose
s
Hi, I am getting the dreaded
java.lang.Class<ViewModel> has no zero argument constructor
error when using the
hiltViewModel
function. Being stuck on this for over two hours now. I have added all the required libs and annotations but the error won’t go. Any help will be appreciated.
It is a multi-module project and was previously working until I moved some modules around, and it just keeps crashing with that error.
c
Oooh. I had this in the past few weeks. Your activity and fragments all have @AndroidEntryPoint right? That error message is painful because it can be so many things. In my case it was because I was using viewModel() and not hiltViewModel()
s
Yes, my activity has the
@AndroidEntryPoint
annotation, and I’m using
hiltViewModel()
. Surprisingly, the entire set up was working perfectly until I just broke down a module into multiple ones, and everything stopped working
It is particularly frustrating cos I checked through everything for hours and still can’t get the app to run
I restructured my modules again, and it started working 🤦. Still don’t know what the cause is. I just hope it doesn’t happen again.
🙏 1
t