LibraryExtension

public interface LibraryExtension extends CommonExtension, TestedExtension


Extension for the Android Library Gradle Plugin.

This is the android block when the com.android.library plugin is applied.

Only the Android Gradle Plugin should create instances of interfaces in com.android.build.api.dsl.

Summary

Public methods

abstract Collection<@NonNull String>

Aidl files to package in the aar.

abstract @NonNull NamedDomainObjectContainer<@NonNull Prefab>

container of Prefab options

abstract @NonNull LibraryPublishing

Customizes publishing build variant artifacts from library module to a Maven repository.

abstract void

Customizes publishing build variant artifacts from library module to a Maven repository.

Inherited methods

From com.android.build.api.dsl.CommonExtension
abstract void

This method is deprecated. Replaced by

abstract void

This method is deprecated. Replaced by installation

abstract void

Specifies options related to the processing of Android Resources.

abstract void

A list of build features that can be enabled or disabled on the Android Project.

abstract void
buildToolsVersion(@NonNull String buildToolsVersion)

This method is deprecated. Replaced by buildToolsVersion property

abstract void

Encapsulates all build type configurations for this project.

abstract void

Specifies Java compiler options, such as the language level of the Java source code and generated bytecode.

abstract void
compileSdkAddon(@NonNull String vendor, @NonNull String name, int version)

Specify an SDK add-on to compile your project against.

abstract void
compileSdkVersion(int apiLevel)

This method is deprecated. Replaced by compileSdk

abstract void

This method is deprecated. Replaced by compileSdkPreview

abstract void
abstract void

Specifies options for the Data Binding Library.

abstract void

Shortcut extension method to allow easy access to the predefined debug BuildType

abstract void

Specifies defaults for variant properties that the Android plugin applies to all build variants.

abstract void

Specifies options for external native build using CMake or ndk-build.

abstract void

This method is deprecated. Replaced by flavorDimensions property

abstract @NonNull AaptOptions

Specifies options for the Android Asset Packaging Tool (AAPT).

abstract @NonNull AdbOptions

Specifies options for the Android Debug Bridge (ADB), such as APK installation options.

abstract @NonNull LibraryAndroidResources

Specifies options related to the processing of Android Resources.

abstract @NonNull LibraryBuildFeatures

A list of build features that can be enabled or disabled on the Android Project.

abstract @NonNull String

Specifies the version of the SDK Build Tools to use when building your project.

abstract @NonNull NamedDomainObjectContainer<@NonNull LibraryBuildType>

Encapsulates all build type configurations for this project.

abstract @NonNull CompileOptions

Specifies Java compiler options, such as the language level of the Java source code and generated bytecode.

abstract Integer

Specifies the API level to compile your project against.

abstract Integer

Specifies the SDK Extension level to compile your project against.

abstract String

Specify a preview API to compile your project against.

abstract @NonNull ComposeOptions
abstract @NonNull DataBinding

Specifies options for the Data Binding Library.

abstract @NonNull LibraryDefaultConfig

Specifies defaults for variant properties that the Android plugin applies to all build variants.

abstract @NonNull File
abstract @NonNull Map<@NonNull String, @NonNull Object>

Additional per module experimental properties.

abstract @NonNull ExternalNativeBuild

Specifies options for external native build using CMake or ndk-build.

abstract @NonNull List<@NonNull String>

Specifies the names of product flavor dimensions for this project.

abstract @NonNull Installation

Specifies options for the Android Debug Bridge (ADB), such as APK installation options.

abstract @NonNull JacocoOptions

Configure the gathering of code-coverage from tests.

abstract @NonNull Lint

Specifies options for the lint tool.

abstract @NonNull LintOptions

Specifies options for the lint tool.

abstract String

The namespace of the generated R and BuildConfig classes.

abstract String

Requires the specified path to NDK be used.

abstract @NonNull String

Requires the specified NDK version to be used.

abstract @NonNull Packaging

Specifies options and rules that determine which files the Android plugin packages into your APK.

abstract @NonNull Packaging

Specifies options and rules that determine which files the Android plugin packages into your APK.

abstract @NonNull NamedDomainObjectContainer<@NonNull LibraryProductFlavor>

Encapsulates all product flavors configurations for this project.

abstract String

Specifies this project's resource prefix to Android Studio for editor features, such as Lint checks.

abstract @NonNull SdkComponents
abstract @NonNull NamedDomainObjectContainer<@NonNull ApkSigningConfig>

Encapsulates signing configurations that you can apply to [ ] and [ ] configurations.

abstract @NonNull NamedDomainObjectContainer<@NonNull AndroidSourceSet>

Encapsulates source set configurations for all variants.

abstract @NonNull Splits

Specifies configurations for building multiple APKs or APK splits.

abstract @NonNull TestCoverage

Configure the gathering of code-coverage from tests.

abstract @NonNull TestOptions

Specifies options for how the Android plugin should run local and instrumented tests.

abstract @NonNull ViewBinding

Specifies options for the View Binding Library.

abstract void

Specifies options for the Android Debug Bridge (ADB), such as APK installation options.

abstract void

This method is deprecated. Renamed to testCoverage

abstract void

Specifies options for the lint tool.

abstract void

This method is deprecated. Renamed to lint

abstract void
packaging(
    @ExtensionFunctionType @NonNull Function1<@NonNull PackagingUnit> action
)

Specifies options and rules that determine which files the Android plugin packages into your APK.

abstract void

This method is deprecated. Renamed to packaging

abstract void

Encapsulates all product flavors configurations for this project.

abstract void

Shortcut extension method to allow easy access to the predefined release BuildType

abstract void
setBuildToolsVersion(@NonNull String buildToolsVersion)

Specifies the version of the SDK Build Tools to use when building your project.

abstract void
setCompileSdk(Integer compileSdk)

Specifies the API level to compile your project against.

abstract void
setCompileSdkExtension(Integer compileSdkExtension)

Specifies the SDK Extension level to compile your project against.

abstract void
setCompileSdkPreview(String compileSdkPreview)

Specify a preview API to compile your project against.

abstract void
setNamespace(String namespace)

The namespace of the generated R and BuildConfig classes.

abstract void
setNdkPath(String ndkPath)

Requires the specified path to NDK be used.

abstract void

Requires the specified NDK version to be used.

abstract void
setResourcePrefix(String resourcePrefix)

Specifies this project's resource prefix to Android Studio for editor features, such as Lint checks.

abstract void

Encapsulates signing configurations that you can apply to BuildType and ProductFlavor configurations.

abstract void

Encapsulates source set configurations for all variants.

abstract void
splits(
    @ExtensionFunctionType @NonNull Function1<@NonNull SplitsUnit> action
)

Specifies configurations for building multiple APKs or APK splits.

abstract void

Configure the gathering of code-coverage from tests.

abstract void

Specifies options for how the Android plugin should run local and instrumented tests.

abstract void

Includes the specified library to the classpath.

abstract void
useLibrary(@NonNull String name, boolean required)

Includes the specified library to the classpath.

abstract void

Specifies options for the View Binding Library.

From com.android.build.api.dsl.TestedExtension
abstract @NonNull String

Specifies the build type that the plugin should use to test the module.

abstract @NonNull TestFixtures

Options to configure the test fixtures.

abstract String

The namespace used by the android test and unit test components for the generated R and BuildConfig classes.

abstract void

Specifies the build type that the plugin should use to test the module.

abstract void
setTestNamespace(String testNamespace)

The namespace used by the android test and unit test components for the generated R and BuildConfig classes.

abstract void

Options to configure the test fixtures.

Public methods

getAidlPackagedList

@Incubating
abstract Collection<@NonNull StringgetAidlPackagedList()

Aidl files to package in the aar.

getPrefab

@Incubating
abstract @NonNull NamedDomainObjectContainer<@NonNull PrefabgetPrefab()

container of Prefab options

getPublishing

abstract @NonNull LibraryPublishing getPublishing()

Customizes publishing build variant artifacts from library module to a Maven repository.

For more information about the properties you can configure in this block, see LibraryPublishing

publishing

abstract void publishing(
    @ExtensionFunctionType @NonNull Function1<@NonNull LibraryPublishingUnit> action
)

Customizes publishing build variant artifacts from library module to a Maven repository.

For more information about the properties you can configure in this block, see LibraryPublishing