Android: Specify default flavor for dependency that has multiple flavors

168 Views Asked by At

I have a library project that depends on the library with flavors, and my library doesn't have those flavors, which cause build error. I can solve that by using missingDimensionStrategy("minApi", "minApi23", "minApi18") documentation in my library build gradle. But this also propagates this dependency to my library, what I mean is that users of my library would have to specify this missingDimensionStrategy("minApi", "minApi23", "minApi18") in their build gradle. Can I somehow configure my library so that clients of my library would not need to specify missingDimensionStrategy and they will be using the dimension that I have specified in my build gradle?

1

There are 1 best solutions below

0
Warlock On

In short there is no such option afaik. You can skip publishing some build variants which will not be part of the artifact. But it will still be defined so matching fallback is needed for build type or defaultConfig with missingDimensionStrategy (which is the simpler choice). See for example this article with list of your options.