resourceConfigurations
Specifies a list of
alternative resources
to keep.
For example, if you are using a library that includes language resources (such as
AppCompat or Google Play Services), then your APK includes all translated language strings
for the messages in those libraries whether the rest of your app is translated to the same
languages or not. If you'd like to keep only the languages that your app officially supports,
you can specify those languages using the resConfigs property, as shown in the
sample below. Any resources for languages not specified are removed.
android {
defaultConfig {
...
// Keeps language resources for only the locales specified below.
resConfigs "en", "fr"
}
}
You can also use this property to filter resources for screen densities. For example,
specifying hdpi removes all other screen density resources (such as mdpi ,
xhdpi , etc) from the final APK.
Note: auto is no longer supported because it created a number of
issues with multi-module projects. Instead, you should specify a list of locales that your
app supports, as shown in the sample above. Android plugin 3.1.0 and higher ignore the
auto argument, and Gradle packages all string resources your app and its dependencies
provide.
To learn more, see
Remove unused alternative resources.
|