user4386126
user4386126

Reputation: 1245

Different string resources for different flavor build types

Let's say I have one string I would like to change depending on my build type and flavor. What would be the best way to accomplish that?

I've created the following folder structure:

app/src/main/
app/src/flavor1/
app/src/flavor2/

app/src/main/res/values/my_strings.xml
app/src/flavor1/res/values/my_strings.xml
app/src/flavor2/res/values/my_strings.xml

This all works when I just want different string for each flavor. Now I would also like to separate those string by build type so I've done something like this:

app/src/main/
app/src/flavor1/
app/src/flavor2/
app/src/flavor1Release/
app/src/flavor2Release/

The problem which appears now is that if I want to create values folder inside app/src/flavor1Release/res, I receive the message that values folder already exists. How can I go around this issue?

Upvotes: 6

Views: 1754

Answers (1)

ben75
ben75

Reputation: 28706

You must do something like this :

app/src/main/
app/src/flavor1Debug/
app/src/flavor2Debug/
app/src/flavor1Release/
app/src/flavor2Release/

Upvotes: 3

Related Questions