I have been struggling for a while with gradle and build variants.
I have these build types defined:
And these fl
The folder structure while creating build variants should be:
app
|
->src
|
->buildvariantname1(as defined in gradle)
|
->java (follow the same structure here, as in main folder)
->res (follow the same structure here, as in main folder)
Now on selecting the specific variant, like buildVariantname1debug, the changes written in the res folder under this variant will be selected.
The app name should be defined under string.xml under res->values folder so that the app name gets fetched depending upon the value in the xml under each build variant. Same goes for app icons.
First image shows how to declare build variants(flavors with different package names)
The second image shows, how the project structure looks like if you want each flavor to have a different code, drawables and manifest as well. Keep in mind MainActivity is deleted from the main folder so that it can exist in each build variant