We want to produce an Android Archive Library (AAR) and distribute to our clients. In this Android lib we are using some third party dependencies, and we want to protect them from any version conflicts. We also do not want auto-updating of a dependency to the latest version.
For example this scenario: We are using (and needing) version 3 of a dependency and the client version 2 of the same dependency - and for some reason these versions are not compliant and our client is unable to update to version 3. Or this: The client is also using an AAR from another provider that in turn uses the dependency with version 2 - and updating this to version 3 would break this other AAR. To demand every part of the software chain to be compatible with the same dependency version is not always possible at all times.
When using an ordinary JAR, this scenario can easily be avoided by using ShadowJar to include and do relocating of the dependencies at the build step. But for an AAR the best method I've found is to create a custom gradle ShadowJar task according: https://github.com/johnrengelman/shadow/issues/183 and do the relocating step before compiling the actual AAR. But this make your app source files need to import the relocated dependencies directly, i.e: import relocated.org.com.dependency.
However this is not an optimal solution to a, what we thought, common problem scenario with AAR:s as described above. We would like the relocating step to happen after the development stage, when building the AAR. I have not found a satisfiable way to do this. Is there really not a better solution to this?