Manuel Vivo
04/23/2021, 7:36 AMColton Idle
04/23/2021, 9:58 AM// Add Dagger dependencies
dependencies {
implementation 'com.google.dagger:dagger:2.x'
annotationProcessor 'com.google.dagger:dagger-compiler:2.x'
}
If you're using classes in dagger.android you'll also want to include:
implementation 'com.google.dagger:dagger-android:2.x'
implementation 'com.google.dagger:dagger-android-support:2.x' // if you use the support libraries
annotationProcessor 'com.google.dagger:dagger-android-processor:2.x'Colton Idle
04/23/2021, 10:02 AMimplementation("com.google.dagger:dagger:2.34.1")
implementation("com.google.dagger:hilt-core:2.34.1-beta")
implementation("com.google.dagger:hilt-android:2.34.1-beta")
kapt("com.google.dagger:hilt-android-compiler:2.34.1-beta")
root build.gradle
id("dagger.hilt.android.plugin")
and I want to make sure that I'm actually using the right dependencies as I feel like some thing changed since I first started using hilt.Manuel Vivo
04/23/2021, 10:14 AMManuel Vivo
04/23/2021, 10:14 AMJeremy
04/23/2021, 8:28 PMManuel Vivo
06/03/2021, 4:27 PMSingletonComponent? or contribute to the SingletonComponent from a different module?
If it’s the former, you can use the @DefineComponent annotation, see: https://medium.com/androiddevelopers/hilt-adding-components-to-the-hierarchy-96f207d6d92d
If it’s the latter, you should be able to install all the modules in the SingletonComponent directly.ultraon
06/04/2021, 12:34 PMdependencies attr in @Component annotation`). Thank you for your answer @Manuel Vivo. I have impression that using DI Module approach with InstallIn annotation library internal entities may leak into SingletonComponent accidentally, but using interface contract (library Component) I can control what exactly entities will be available in SintletonComponent.ultraon
06/04/2021, 12:34 PMultraon
06/04/2021, 12:35 PMComments:
So we have 2 modules:
- library module that provides some CarEngine (under public interface)
- application module that uses library above and builds Car with CarEngine
Library exposes only interface CarEngine, all internal details (Turbine, EngineTurbine, TurbinedCarEngine) are closed,
so application module can't use them directly.ultraon
06/04/2021, 12:35 PMThe main question:
- Is it possible to have a similar dependency encapsulation using Dagger Hilt?Manuel Vivo
06/07/2021, 7:30 AMultraon
06/13/2021, 3:17 PM