Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NoSuchMethodError: No static method createViewModelLazy

Caused by: java.lang.NoSuchMethodError: No static method createViewModelLazy

I'm using hiltViewmodels. However, this error only appears when attempting to instantiate my viewModel in the library module compiled code. I'm using this compiled code in the form of an aar file that is depended on by a different app module.

The Hilt viewModel dependency injection works great in my original project.
( val viewModel: FeedViewModel by viewModels() )

like image 539
SUR4IDE Avatar asked Oct 23 '25 16:10

SUR4IDE


1 Answers

I had the same Exception, and managed to fix it in Android Studio.

Just clean the project: Open the "Build" menu and click on "Clean Project".

Now running the app should work again.

like image 118
anty Avatar answered Oct 26 '25 06:10

anty



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!