AndroidResources

Added in 7.0.0

interface AndroidResources

Known direct subclasses
AaptOptions

This interface is deprecated. Renamed to AndroidResources

ApplicationAndroidResources

DSL object for configuring Android resource options for Application plugins.

DynamicFeatureAndroidResources

DSL object for configuring Android resource options for Dynamic Feature plugins.

LibraryAndroidResources

DSL object for configuring Android resource options for Library plugins.

TestAndroidResources

DSL object for configuring Android resource options for Test plugins.


DSL object for configuring Android resource options.

This is accessed via CommonExtension.androidResources

Summary

Public functions

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

Public properties

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.

MutableCollection<String>

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

Public functions

additionalParameters

Added in 7.0.0
Deprecated in 8.0.2
fun additionalParameters(params: String): Unit

Adds additional parameters to be passed to aapt.

additionalParameters

Added in 7.0.0
Deprecated in 8.0.2
fun additionalParameters(vararg params: String): Unit

Adds additional parameters to be passed to aapt.

noCompress

Added in 7.0.0
Deprecated in 8.0.2
fun noCompress(noCompress: String): Unit

Adds a file extension of Android resources, assets, and Java resources to be stored uncompressed in the APK. Adding an empty extension (i.e., noCompress('')) will disable compression for all Android resources, assets, and Java resources.

noCompress

Added in 7.0.0
Deprecated in 8.0.2
fun noCompress(vararg noCompress: String): Unit

Adds file extensions of Android resources, assets, and Java resources to be stored uncompressed in the APK. Adding an empty extension (e.g., noCompress('')) will disable compression for all Android resources, assets, and Java resources.

Public properties

additionalParameters

Added in 7.0.0
val additionalParametersMutableList<String>

List of additional parameters to pass to aapt.

These are passed to every AAPT2 resource link invocation for this module. For application and dynamic-feature modules that includes the link that produces the Android App Bundle, as well as the one that produces the APK, so parameters that remove resources affect the bundle too.

This is the supported way to target a single screen density, now that the screen density support in BaseFlavor.resourceConfigurations is deprecated:

android {
androidResources {
additionalParameters += ["--preferred-density", "hdpi"]
}
}

Note that this also removes the other densities from the bundle, which is rarely intended, since a bundle is normally expected to contain every density so that density-specific APKs can be generated from it.

failOnMissingConfigEntry

Added in 7.0.0
var failOnMissingConfigEntryBoolean

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

See aapt --help

ignoreAssetsPattern

Added in 7.0.0
var ignoreAssetsPatternString?

Pattern describing assets to be ignored.

This is ignoreAssetsPatterns joined by ':'.

ignoreAssetsPatterns

Added in 7.3.0
val ignoreAssetsPatternsMutableCollection<String>

Patterns describing assets to be ignored.

If empty, defaults to ["!.svn", "!.git", "!.ds_store", "!*.scc", ".*", "<dir>_*", "!CVS", "!thumbs.db", "!picasa.ini", "!*~"]

noCompress

Added in 7.0.0
val noCompressMutableCollection<String>

File extensions of Android resources, assets, and Java resources to be stored uncompressed in the APK. Adding an empty extension (e.g., setting noCompress '') will disable compression for all Android resources, assets, and Java resources.