title: Android Dynamic Feature modules with Dagger Hilt
body: <p>I have built a Dynamic feature module sample with Fragments, sub components and dependent components based on plaid app, if you wish to check out <a href="https://github.com/SmartToolFactory/Dagger2-Tutorials/tree/master/Tutorial9-2DynamicFeatureImplementation2" rel="nofollow noreferrer">here</a> is the link. Now, i'm trying to convert it to Dagger Hilt using the <a href="https://developer.android.com/training/dependency-injection/hilt-multi-module" rel="nofollow noreferrer">official android document</a>.</p>
  <p>In core module which is the library module, app module and dynamic feature modules depend on</p>
  <pre><code>@Singleton
  @Component(modules = [CoreModule::class])
  interface CoreComponent {
  
      /*
          Provision methods to provide dependencies below to components that depends on
          CoreComponent
       */
      fun coreDependency(): CoreDependency
  
      fun coreCameraDependency(): CoreCameraDependency
  
      fun corePhotoDependency(): CorePhotoDependency
  
      fun coreActivityDependency(): CoreActivityDependency
  
      @Component.Factory
      interface Factory {
          fun create(@BindsInstance application: Application): CoreComponent
      }
  
  }
  </code></pre>
  <p>and it's module</p>
  <pre><code>@Module(includes = [CoreProvideModule::class])
  abstract class CoreModule {
      @Binds
      abstract fun bindContext(application: Application): Context
  }
  
  @Module
  object CoreProvideModule {
  
      @Singleton
      @Provides
      fun provideCoreDependency(application: Application) = CoreDependency(application)
  
      @ActivityScope
      @Provides
      fun provideCoreActivityDependency(context: Context) = CoreActivityDependency(context)
  
      @Provides
      fun provideCoreCameraDependency(): CoreCameraDependency = CoreCameraDependency()
  
      @Provides
      fun provideCorePhotoDependency(): CorePhotoDependency = CorePhotoDependency()
  
  }
  </code></pre>
  <p>How is CoreComponent migrated? Do provision methods still stay and i only change</p>
  <pre><code>@Singleton
  @DefineComponent
  </code></pre>
  <p>or</p>
  <pre><code>@Singleton
  @DefineComponent(parent = ApplicationComponent.class)
  </code></pre>
  <p>for CoreModule i guess i only change</p>
  <pre><code>@EntryPoint
  @InstallIn(CoreComponent::class)
  </code></pre>
  <p>or is this for adding provision methods in <code>CoreComponent</code>?</p>
  <p>How do i create sub-component in app module?</p>
  <p>If anyone has a sample with dynamic feature fragments and hilt, or tutorial to build, it would be more than welcome. I'm just working on it at the moment, if i figure it out i would post an answer</p>