Bartosz Ostrowski
Bartosz Ostrowski

Reputation: 431

Android Studio - nested flavors (Gradle)

I am trying to generate different APKs for free and paid version (removed ads in layout files), additionally I want to track with Google Analytics downloads from different stores (Google Play, Amazon, etc.)

In the directory tree it would look like this:

\
\[free]
       \[amazon]
       \[googleplay]
       \common part for free app
\[pro]
      \[amazon]
      \[googleplay]
      \common part for paid app

Is it possible to have such build variants with Gradle build? If not, what would you be your suggested solution. I know I can prepare flavors in flat structure (amazonfree, amazonpro, googleplayfree, googleplaypro), but some of the code would have to be duplicated.

Upvotes: 3

Views: 499

Answers (1)

ligi
ligi

Reputation: 39549

flavorDimensions is what you search for. One dimension would be price for you ( free/paid ) and the other dimension is the store (play/amazon/..)

Upvotes: 3

Related Questions