ApplicationAndroidResources

Added in 8.1.0

interface ApplicationAndroidResources : AndroidResources


DSL object for configuring Android resource options for Application plugins.

This is accessed via ApplicationExtension.androidResources

Summary

Public properties

Boolean

Property that automatically generates locale config when enabled.

MutableSet<String>

Specifies a list of locales that resources will be kept for.

Inherited functions

From com.android.build.api.dsl.AndroidResources
Unit

This function is deprecated. Replaced with property additionalParameters

Unit
additionalParameters(vararg params: String)

This function is deprecated. Replaced with property additionalParameters

Unit
noCompress(noCompress: String)

This function is deprecated. Replaced with property noCompress

Unit
noCompress(vararg noCompress: String)

This function is deprecated. Replaced with property noCompress

Inherited properties

From com.android.build.api.dsl.AndroidResources
MutableList<String>

List of additional parameters to pass to aapt.

Boolean

Forces aapt to return an error if it fails to find an entry for a configuration.

String?

Pattern describing assets to be ignored.

MutableCollection<String>

Patterns describing assets to be ignored.

Boolean

Indicates whether the resources in this sub-project are fully namespaced.

MutableCollection<String>

File extensions of Android resources, assets, and Java resources to be stored uncompressed in the APK.

Public properties

generateLocaleConfig

Added in 8.1.0
var generateLocaleConfigBoolean

Property that automatically generates locale config when enabled.

localeFilters

Added in 8.8.0-rc01
val localeFiltersMutableSet<String>

Specifies a list of locales that resources will be kept for.

For example, if you are using a library that includes locale-specific 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 localeFilters property, as shown in the sample below. Any resources for locales not specified are not included in the build.

android {
androidResources {
...
// Keeps language resources for only the locales specified below.
localeFilters += listOf("en-rGB", "fr")
}
}

The locale must be specified either as (1) a two-letter ISO 639-1 language code, with the option to add a two-letter ISO 3166-1-alpha-2 region code preceded by "-r" (e.g. en-rUS), or (2) a BCP-47 language tag, which additionally allows you to specify a script subtag (e.g. b+sr+Latn+RS).

For more information on formulating locale qualifiers, see "Language, script (optional), and region (optional)" in the alternative resources table.