Skip to content
Advertisement

Hilt :- Not able to use the @AndroidEntryPoint in the AppCompatActivity getting DefaultV iewModelFactories exceptions?

I want to use the Hilt in my project for getting the helper class object as the common for my activity. I have tried the below lines of code for it

Manifest file entry

JavaScript

My AppController class

JavaScript

Please check my gradles file for it

JavaScript

Please check my classPath entry below

JavaScript

Now please check my NVModule Module class in which i have used the Hilt

JavaScript

Now please check the Activity class in which i have injected the Hilt object

JavaScript

But I am getting the following exception while Running the app please check it once

Exception:-

/home/…./com/my/app/activity/Hilt_AutomaticTestActivity.java:70: error: method getActivityFactory in class DefaultViewModelFactories cannot be applied to given types; return DefaultViewModelFactories.getActivityFactory(this); ^ required: ComponentActivity,Factory found: Hilt_AutomaticTestActivity reason: actual and formal argument lists differ in length

Please help me to short of from this problem

Advertisement

Answer

Seems to be version mismatch. Use following versions:

JavaScript

And

JavaScript

And

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement