Zhen Liu
Zhen Liu

Reputation: 7932

define flavor and buildtype specific strings

I need to set a string that is specific to each buildtype and flavor in my app.

I have build type: dev and release I have flavor: flavor1, flavor2, flavor3 Is there a way i could declare a string that is unique in each flavor/buildtype combination?

So intuitively i should have 6 different strings. But where and how i could declare them?

If i put them in gradle that is only different for build types.

Or i could put them in

flavor1/res/strings.xml
flavor2/res/strings.xml
flavor3/res/strings.xml

But this is only flavor specific.

Upvotes: 0

Views: 138

Answers (1)

Dr Glass
Dr Glass

Reputation: 1489

You can do it like this:

src/flavor1Release/res/values/strings.xml
src/flavor2Release/res/values/strings.xml
src/flavor3Release/res/values/strings.xml
src/flavor1Debug/res/values/strings.xml
src/flavor2Debug/res/values/strings.xml
src/flavor3Debug/res/values/strings.xml

so just create flavor-buildtype combination directory and put your specific files there.

Documentation: http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Sourcesets-and-Dependencies

Upvotes: 1

Related Questions