Search code examples
android-studiodependency-injectionviewmodeldagger-hilt

Hilt can't find Application class even after been annotated with @HiltAndroidApp


I have an issue with Hilt, I keep getting the error in the image below: enter image description here

As the error indicates adding the annotation @HiltAndroidApp to the AppController class. I have already done this and the class name has also been added to the manifest file. Also, all the activities and fragments classes where hilt injection is used have been annotated with @AndroidEntryPoint. I have tried to debug the issue for hours but to no avail. The crash happens when super.onCreate(savedInstanceState) is called in the SignupActivity.kt file. Below is what part of the file looks like: enter image description here

enter code here

Solution

  • Found a fix, My project is a multi module project. I failed to add hilt dependency to the app module (though it was present in the commons module). Hence it could not @HiltAndroidApp Annotation