I am trying to use the resConfig and resConfigs from the Android Build system.
- Android Studio version 1.2.2
- Gradle build version 1.2.3
- OSX 10.10.3
I was having problem with these 2 options with my project so I started a new blank project with android studio. I attached my build.gradle where I only added resConfigs "en", "fr" under
android {
defaultConfig {
...
resConfigs "en", "fr"
...
}
}
And defined 2 basic flavors
productFlavors {
fr {
resConfig "fr"
}
en {
resConfig "en"
}
}
I then created a 2 strings.xml files and translated the hello_world default label
/src/main/res/values/strings.xml (default)
/src/main/res/values-en/strings.xml
/src/main/res/values-fr/strings.xml
With this, I would expect to see only 3 values folders in MyApplication/app/builds/intermediates/res/en/debug since I defined in the resConfigs to only use "en" and "fr" and filter anything else
/values/
/values-en/
/values-fr/
Although, all languages values folder are still in there so the resConfigs is not filtering anything apparently.
I would also expect to see the label hello_world from values-en when running enDebug flavor variant since I specified that the flavor en would use resConfig "en" although when I run the test app I see the label from /values-fr/strings.xml instead of /values-en/strings.xml since the language on the tablet is configured as French Canada
Am I misunderstanding the purpose behind resConfig? If so, how am I supposed to force a flavor to only run in only language and not be dependant on the OS locale setting? This solution must be compatible with flavorDimensions too since I use them in the real app I'm trying to configure.
NOTE: I also filed a bug since I think there really is a problem with this resConfig behavior https://code.google.com/p/android/issues/detail?id=180694
Thanks
context
used is from anActivity
and not from anApplication
. – Swoop