I develop an android library. The library depends on appcompat-v7
. My consumers also depend on appcompat-v7
. How do I most correctly expose my appcompat dependency from the libray when publishing to a maven repository?
What I'm doing now
- Listing the
appcompat-v7
dependency as animplementation
dependency in the library - Using android-maven-publish to publish POM files which causes the dependency to be listed with Scope "runtime"
Yet with this setup the version preference of the library bleeds onto the consumer. Here is a screenshot from the consumer's project view where the library version is using v27.0.0 and the consumer is set up with 26.1.0:
v27.0.0 takes presedence over v26.1.0, causing compiler errors (because the Fragment signature has changed).
Is there any way to avoid this by configuring the library different, or should this be the result? Am I wrong in assuming that different versions of the appcompat lib should be allowed in the library and in the consuming app? Should I instead publish multiple binaries, each compiled against a different version of the support library to satisfy any given consumer setup?