bhavesh kaila
bhavesh kaila

Reputation: 761

Create product flavoured using android studio

I want to create different product flavoured and I want to use main application code into created product flavoured.

I have created Two flavoured from this link but I am not able to use my Main application code into created product flavoured.

I have mentioned package structured below and please let me know how can I use it.enter image description here

I have placed flavoured code inside src folder.

Thanks in advance, And any help will be appreciated.

Upvotes: 0

Views: 76

Answers (1)

Antonio Cappiello
Antonio Cappiello

Reputation: 504

This post explains step by step how to configure your directory structure and gradle file.

The main steps are:

  1. add the product flavours container to the app build.gradle file

    productFlavors { free { applicationId "antoniocappiello.com.buildvariantsexample.free" } paid { applicationId "antoniocappiello.com.buildvariantsexample.paid" } }

  2. create inside src a directory with the exact name of the product flavour that you want to look different from the main variant, for example with the configuration at step 1 the directory name could be paid or free

Directory structure example

Upvotes: 1

Related Questions