google/dagger

Dagger resolution and dynamic feature module

snijsure opened this issue · 1 comments

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:

  • When the DFM is loaded code is running Dagger version X or Dagger Version X+N?
  • Should there be any issues if host app and DFM are using different versions of dagger?

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

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.