Combine BuildType and Flavor resources

android, gradle

Solution

Just create a folder `src/freeappRelease/res/values/` and add your very specific strings in this folder.

Problem

I have 2 versions of app: paid-app and free-app. I use gradle and Android Studio. I have next folder structure: `src` folder, and inside it 3 folders: `main`, `paidapp`, `freeapp` - where paidapp and freeapp are flavors. My configs: ``` defaultConfig { applicationId "com.company" } buildTypes { debug { applicationIdSuffix '.dev' } } productFlavors { freeapp { } paidapp { applicationId 'com.company.paidapp' } } ``` What I want: have on my phone 4 apps: ``` package com.company.dev, name "dev freeapp" package com.company.paidapp.dev, name "dev paidapp" package com.company, name "freeapp" package com.company.paidapp, name "paidapp" ``` package is ok, gradle manage it automatically, but how to create different names for app? App name located in `strings.xml` in `src/paidapp/res/values/strings.xml`: ``` <string name="appName">dev paidapp</string> ``` in `src/freeapp/res/values/strings.xml`: ``` <string name="appName">dev freeapp</string> ``` I looked there - http://tools.android.com/tech-docs/new-build-system/resource-merging The priority order is the following: BuildType -> Flavor -> main -> Dependencies. So I can chose or string from BuildType or from Flavor, but how to combine BuildType and Flavor?

Original source