Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: How to Solve Library Dependency conflict [closed]

Tags:

android

gradle

I am developing an Android Library. The Library is having few dependency. I am not sure what will happen if the developer use my library with other dependencies already present in my Library. I tried to googling about this but couldn't find anything.

For example I am using Volley Library of version X in my Library and shipping it as gradle package. And the developer imports Volley with Version Y along with my Library.

What should be the best way to include a Dependency in a Library (module, jar or package) so as to minimise conflict situation.

like image 683
Abhishek Batra Avatar asked Jun 12 '15 07:06

Abhishek Batra


1 Answers

Two options

  1. Possible ways to include the dependencies of your dependencies in them is to create a fat/uber/share jar (there are Gradle plugins for that). Use a custom classloader to load jars within a jar using One-Jar. Or to use Jar Jar Links.
  2. The second option is to specificaly exclude transistive dependencies doing:

    compile('X') {
        exclude module: 'Y'
    }
    
like image 109
HELOX Avatar answered Oct 13 '22 01:10

HELOX