问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/32452209/dagger-1-and-dagger-2-package-names-conflict