androidandroid-flavors

when to use android flavours vs separate projects


I have been doing some reading on Android flavours and how to use them in SO and other resources such as

1)Building Multiple Editions of an Android App with Gradle

2)Building multiple flavours of an Android app

based on these examples, android flavours are very useful for building multiple editions of the app. but my question is:

Is it a good practice to use flavours in scenarios that service provider and consumer roles have separate app like uber or it is better to build separate projects.

what are the main attributes we need to consider before using flavours?


Solution

  • From Android docs:

    Product flavors represent different versions of your app that you may release to users, such as free and paid versions of your app. You can customize product flavors to use different code and resources, while sharing and reusing the parts that are common to all versions of your app.

    So, product flavors should be used to create customized versions of the same app. Different flavors may differ in some part of resources and functions but they are almost the same app.

    For building different apps that are related to each other and share some part of code it is better to use modules. You'll have 2 application modules for apps and a library module which contains a common part of code. Application modules will depend on library module.