Remove app_name from strings.xml (else gradle will complain of duplicate resources). Then modify build file like this:
productFlavors {
flavor1{
resValue "string", "app_name", "AppNameFlavor1"
}
flavor2{
resValue "string", "app_name", "AppNameFlavor2"
}
}
Also make sure @string/app_name value is assigned for android:label attribute in the manifest.
<application
...
android:label="@string/app_name"
...
This is less disruptive than creating new strings.xml under different built sets or writing custom scripts.