0

I have a project where I need to make new builds once a month or so with incremental changes. The previous minimum supported API level was 19 and some devices were at that level so it was necessary to support it.

A new dependency that is being implemented (by the client) requires a new minimum API of 21 and there will be a large quantity of code inserted to support it.

The core of the issue here is that moving forward I still need to support a build a month (ish), I need to support those older API level 19 devices, and I need to support the new code for API level 21 or higher devices.

I have been thinking of simply changing the minimum API level, removing the new dependency, commenting out the new code, and making a build for API 19 devices and then undoing that process to make the new build for API 21+ devices, but that seems awfully inefficient.

My question therefore is, what is the most efficient way to create multiple builds that have to support different API levels without going through and commenting out code and removing dependencies?

PGMacDesign
  • 6,092
  • 8
  • 41
  • 78
  • Use flavors https://developer.android.com/studio/build/build-variants#product-flavors – maja89 Apr 25 '19 at 17:08
  • Flavors would be a great idea if I wanted to change certain sections of code to just augment them, but in this case I need to remove dependencies and remove code that is depending on said library; I don't know of a way to make flavors do that. Thanks for the suggestion though. – PGMacDesign Apr 26 '19 at 19:57
  • 1
    See https://stackoverflow.com/questions/18196974/how-to-define-different-dependencies-for-different-product-flavors – maja89 Apr 26 '19 at 22:55
  • 1
    Also see https://android.jlelse.eu/product-flavors-for-android-library-d3b2d240fca2 – maja89 Apr 27 '19 at 08:54

0 Answers0