'Is ApplicationComponent deprecated?

I just started using Dagger Hilt for dependency injection on Android and I get a warning on Android Studio saying 'ApplicationComponent' is deprecated. Deprecated in Java.

I didn't find anything related to this warning while Googling, is it actually deprecated or is it safe to use?

I also noticed on Dagger's website that they don't mention it anywhere in the "Migrating to Hilt" guide and they use @InstallIn(SingletonComponent::class) which seems to be working but I have no idea why.



Solution 1:[1]

ApplicationComponent being renamed to SingletonComponent, to allow usage of Hilt in non-Android Gradle modules link

Solution 2:[2]

Is ApplicationComponent deprecated?

Yes, it is deprecated.

Instead of ApplicationComponent, you can use SingletonComponent. This is an Hilt component for singleton bindings

Solution 3:[3]

replace with @InstallIn(SingletonComponent :: class) It will work

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Saeed Lotfi
Solution 2 Suraj Gupta
Solution 3 Kotipalli Madhu Meher