1

I have an Android project in which one 3rd party library depends on Dagger 1 and my project on Dagger 2.

Dagger 1 and 2 have the same package names so my app is working fine, but 3rd party library is not working because of overriding dagger 1 package by dagger 2.

Changing the package name of Dagger 2 to dagger2 instead of dagger is not an option because annotation compiler is generating classes with static package name dagger.

Is there a way of resolving this conflict?

Derek
  • 1,572
  • 1
  • 14
  • 25
Dominik Mičuta
  • 357
  • 4
  • 13

1 Answers1

0

Use jarjar on the 3rd party library jar, or at least the dagger parts. That will move the dagger code (and any references) into its own package. As that is happening after the annotation processor has run it should catch all the code.

Paul Duffin
  • 201
  • 1
  • 4
  • I tried that but dagger 2 generated DI factories with old dagger 2 package name - I think dagger 2 annotation processor has dependencies on original dagger 2 sources for generation classes. I didnt find any way how to solve this so I used Dagger 1 instead. :( – Dominik Mičuta Oct 08 '15 at 12:13
  • @DConan - I'm a little confused. If the dagger 1 code has been repackaged to something else how can that affect dagger 2? Does dagger 2 process the repackaged files in some way? – Paul Duffin Oct 09 '15 at 12:53