Search code examples
androidgradleandroid-gradle-plugindependencies

Gradle always downloads dependencies with latest version


I have an app that uses 'library 1' and 'library 2' . Let's say library1 uses coil version-1(an image library for example) and library2 uses coil version 2... when implementing both library 1 and library 2 in my app... only the latest version of coil i.e., coil version 2 is downloaded... is there any way to mitigate this issue?


Solution

  • AFAIK you cannot have library1 using coil version-1 and library2 using coil version-2. Possible approaches:

    1. Do nothing, only works if library1 works with coil version-2.
    2. Force the coil dependency to be version-1. Only works if library2 works with coil version-1.
    3. Use an older version of library2 which has a dependency on coil version-1.
    4. Find an alternative library to library1 which uses a more recent version of coil.