google / dagger

A fast dependency injector for Android and Java.
https://dagger.dev
Apache License 2.0
17.45k stars 2.02k forks source link

Dagger resolution and dynamic feature module #4294

Closed snijsure closed 6 months ago

snijsure commented 6 months ago

I have question about dependency resolution and dynamic feature module.

Say I have host app that is using Dagger version X. This host app installs Dynamic Feature Module that uses Dagger version X+N, this DFM has its own dependency tree.

Question:

If this is the wrong forum to ask this question, where in https://issuetracker.google.com/ should I post this query?

danysantiago commented 6 months ago

I will assume you are using Gradle in your project. Dependencies in the feature module are managed by Gradle along with the Android Gradle Plugin, usually feature modules have an implementation dependency on the 'app' module. Which means standard dependency resolution conflict is applied and the highest version of Dagger is chosen, may that be defined in the app or in the feature module. For a more detailed answer you can try asking the AGP team at https://issuetracker.google.com/issues/new?component=192708&template=840533

Since Dagger has a small runtime and mostly generates code, it's unlikely to run into version skew issues (assuming the version difference is not big), but it can still happen. In general it is safe to use new runtime with old generated code (backwards compatibility is maintained) but it's not possible for Dagger to guarantee for old runtime to work with new codegen.