Dagger 2: Multiple entries with same key
<h1>Short explanation</h1>

<p>Simplified UML diagram that describes by <code>Components</code> architecture.</p>

<p><a href="https://i.stack.imgur.com/cotoP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cotoP.png" alt="enter image description here"></a></p>

<p>And there is an exception:</p>

<pre><code>java.lang.IllegalArgumentException: 
Multiple entries with same key: 
gson=com.example.di.AppPresentationComponent and
gson=com.example.di.gamesession.GameSessionComponent
</code></pre>

<p><code>Dagger 2</code> cannot decide from which <code>Component</code> provide an <code>Gson</code> instance.</p>

<p>I never ever work with multiple inheritance. What can you recommend to solve my situation?</p>

<p>I can dispose of <code>GameSessionComponent</code> and move <code>gameSessionManager()</code> to <code>GameSessionPresentationComponent</code>. It will work in my case, but it's sounds like a dirty solution.</p>

<h1>There is some code.</h1>

<p>AppComponent:</p>

<pre><code>@PerApplication
@Component(modules = arrayOf(
        AppModule::class,
        TextsModule::class,
        AudioModule::class,
        FontsModule::class,
        TexturesModule::class,
        QuestModule::class,
        GameSaveModule::class
))
interface AppComponent {
    fun componentsHolder(): ComponentsHolder
    fun gdxContext(): GdxContext
    fun rxHelper(): RxHelper
    fun textsManager(): TextsManager
    fun soundsManager(): AudioManager
    fun fontsManager(): FontsManager
    fun texturesManager(): ThemesManager
    fun questManager(): QuestManager
    fun gameSaveManager(): GameSaveManager
}
</code></pre>

<p>AppPresentationComponent</p>

<pre><code>@PerApplicationPresentation
@Component(
        dependencies = arrayOf(AppComponent::class),
        modules = arrayOf(AppPresentationModule::class)
)
interface AppPresentationComponent : AppComponent {
    fun fonts(): Fonts
    fun audio(): Audio
    fun texts(): Texts
    fun textures(): Textures
    fun router(): KRQRouter
    fun launch(): LaunchScreen
    fun mainMenu(): MenuScreen
    fun settingsDialog(): SettingsDialog
    fun questInfoDialog(): InfoDialog
}
</code></pre>

<p>GameSessionComponent</p>

<pre><code>@PerGameSession()
@Component(
        dependencies = arrayOf(AppComponent::class),
        modules = arrayOf(GameSessionModule::class)
)
interface GameSessionComponent : AppComponent {
    fun storyTeller(): StoryTeller
}
</code></pre>

<p>GameSessionPresentationComponent</p>

<pre><code>@PerGameSessionPresentation
@Component(
        dependencies = arrayOf(AppPresentationComponent::class),
        modules = arrayOf(GameSessionPresentationModule::class, GameSessionModule::class)
)
interface GameSessionPresentationComponent : AppPresentationComponent {
    fun storyTeller(): StoryTeller

    fun story(): StoryScreen
    fun gameoverDialog(): GameoverDialog
    fun inGameMenu(): InGameMenu
    fun donateDialog(): DonateDialog
}
</code></pre>