LibraryAndroidResources

Added in 8.1.0

interface LibraryAndroidResources : AndroidResources


DSL object for configuring Android resource options for Library plugins. This is accessed via LibraryExtension.androidResources

Summary

Public properties

Boolean

Flag to enable Android resource processing in this library module Default value is 'true' for plain android libraries and 'false' for multiplatform libraries.

String

Specifies a resource name prefix required for all resources defined in this module.

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.

MutableCollection<String>

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

Public properties

enable

Added in 8.11.0
var enableBoolean

Flag to enable Android resource processing in this library module Default value is 'true' for plain android libraries and 'false' for multiplatform libraries.

resourcePrefix

Added in 9.5.0-alpha03
var resourcePrefixString

Specifies a resource name prefix required for all resources defined in this module.

This setting is used by Android Studio editor features and Android Lint checks (the ResourceName detector) to ensure that all resources in this module adhere to the prefix convention.

This property does not automatically prepend the prefix to resources at build time; rather, it validates and enforces that developer-defined resource names begin with the prefix, flagging violations during IDE editing and command-line ./gradlew lint runs.

Including unique prefixes for module resources helps avoid naming collisions when resources from multiple libraries are merged into a single application namespace.

When specifying a prefix:

  • It is recommended to include a trailing underscore (e.g. "mylib_").

  • XML and file resource names must start with the snake_case prefix (e.g., mylib_header_icon.xml, @string/mylib_button_label).

  • Styleables and attributes can use the camelCase equivalent (e.g., <declare-styleable name="MyLibView"> or myLibAttribute).

You can specify this prefix as shown below:

android {
androidResources {
resourcePrefix = "mylib_"
}
}