Jay Sidri
Jay Sidri

Reputation: 6406

Android/Gradle: App name based on build type *and* product flavor

I have 3 build types (debug, UAT and release) and 2 flavors (international and local).

I have my app name defined in a xml file named "product_name.xml":

<resources xmlns:tools="http://schemas.android.com/tools"
    tools:ignore="MissingTranslation">

   <string name="app_title">Awesome App</string>

</resources>

I want to change the app name based on the build variant (build type + flavor). E.g:

and so on.

How would I do about this? All the examples I've seen show me how to change the name based on either build type or the flavor but not both.

Upvotes: 4

Views: 865

Answers (1)

Christopher
Christopher

Reputation: 10259

You could create src-folders for your variants and place your custom strings there:

src
|-> InternationalDebug
|   |->res/values/strings.xml <-- place your app_title here
|-> LocalUAT
|   |->res/values/strings.xml <-- place your app_title here
|-> main (contains your main source code.

Upvotes: 4

Related Questions