Reputation: 5131
I have an Android application which I've modularized so that it can be included in other projects as a dependency.
This module depends on libraries like Dagger and Retrofit.
What I'm seeing is that transitive dependencies from this module are conflicting with previous versions existing within the parent consumer application.
For example, if the parent is using Dagger 2.9 and the module is using 2.24, then Gradle resolves this dependency to 2.24 which causes breaking changes in the parent app due to deprecations or other various reasons.
I've tried excluding these conflicting dependencies within my Gradle configuration but then this causes the module to break.
How can I resolve this issue? Do I need to force the parent application to update dependencies?
Upvotes: 0
Views: 641
Reputation: 23503
The parent would need to force the use of the correct dependency by doing:
implementation('com.google.dagger:dagger:2.x') {
force = true
}
or if you are using api
:
api ('com.google.dagger:dagger:2.x'){
force = true
}
For more information you can reference the Gradle Docs.
Upvotes: 1