Migrating From Dagger to Hilt | raywenderlich.com

Learn about Hilt and its API. Discover how Hilt facilitates working with Dagger by migrating the code of an existing app from Dagger to Hilt.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/14212867-migrating-from-dagger-to-hilt

Thank you for sharing this tutorial. It is very helpful. Sharing the following feedback in case you want to update the article for future readers.

With latest Hilt update, @InstallIn(ApplicationComponent::class) doesn’t work. We need @InstallIn(SingletonComponent::class) instead.
Also, I wasn’t able to run after all the changes. I was getting java.lang.invoke.LambdaMetafactory’ appears in /apex/com.android.art/javalib/core-oj.jar)… error.
This was fixed by adding

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8*
targetCompatibility JavaVersion.VERSION_1_8*
}

in build.gradle(:app).