Stay organized with collections
Save and categorize content based on your preferences.
DslLifecycle
@Incubating interface DslLifecycle<T>
Known Indirect Subclasses
|
Summary
Public methods
|
abstract Unit |
API to customize the DSL Objects programmatically after they have been evaluated from the
build files and before used in the build process next steps like variant or tasks creation.
|
abstract Unit |
Action based version of finalizeDsl above.
|
Public methods
finalizeDsl
abstract fun finalizeDsl(callback: (T) -> Unit): Unit
API to customize the DSL Objects programmatically after they have been evaluated from the
build files and before used in the build process next steps like variant or tasks creation.
Example of a build type creation:
androidComponents.finalizeDsl { extension ->
extension.buildTypes.create("extra")
}
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# DslLifecycle\n============\n\n```\n@Incubating interface DslLifecycle\u003cT\u003e\n```\n\n|-------------------------------------------------|\n| [com.android.build.api.variant.DslLifecycle](#) |\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [AndroidComponentsExtension](/reference/tools/gradle-api/7.1/com/android/build/api/variant/AndroidComponentsExtension), [LintLifecycleExtension](/reference/tools/gradle-api/7.1/com/android/build/api/variant/LintLifecycleExtension) |------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------| | [AndroidComponentsExtension](/reference/tools/gradle-api/7.1/com/android/build/api/variant/AndroidComponentsExtension) | Generic extension for Android Gradle Plugin related components. | | [LintLifecycleExtension](/reference/tools/gradle-api/7.1/com/android/build/api/variant/LintLifecycleExtension) | \u003cbr /\u003e | |\n\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Indirect Subclasses [ApplicationAndroidComponentsExtension](/reference/tools/gradle-api/7.1/com/android/build/api/variant/ApplicationAndroidComponentsExtension), [DynamicFeatureAndroidComponentsExtension](/reference/tools/gradle-api/7.1/com/android/build/api/variant/DynamicFeatureAndroidComponentsExtension), [LibraryAndroidComponentsExtension](/reference/tools/gradle-api/7.1/com/android/build/api/variant/LibraryAndroidComponentsExtension), [TestAndroidComponentsExtension](/reference/tools/gradle-api/7.1/com/android/build/api/variant/TestAndroidComponentsExtension) |----------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------| | [ApplicationAndroidComponentsExtension](/reference/tools/gradle-api/7.1/com/android/build/api/variant/ApplicationAndroidComponentsExtension) | Extension for the Android Application Gradle Plugin components. | | [DynamicFeatureAndroidComponentsExtension](/reference/tools/gradle-api/7.1/com/android/build/api/variant/DynamicFeatureAndroidComponentsExtension) | Extension for the Android Dynamic Feature Gradle Plugin components. | | [LibraryAndroidComponentsExtension](/reference/tools/gradle-api/7.1/com/android/build/api/variant/LibraryAndroidComponentsExtension) | Extension for the Android Library Gradle Plugin components. | | [TestAndroidComponentsExtension](/reference/tools/gradle-api/7.1/com/android/build/api/variant/TestAndroidComponentsExtension) | Extension for the Android Test Gradle Plugin components. | |\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [finalizeDsl](#finalizeDsl(kotlin.Function1))`(`callback:` `(T)` `-\u003e` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`)` API to customize the DSL Objects programmatically after they have been evaluated from the build files and before used in the build process next steps like variant or tasks creation. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [finalizeDsl](#finalizeDsl(org.gradle.api.Action))`(`callback:` `[Action](https://docs.gradle.org/current/javadoc/org/gradle/api/Action.html)\u003cT\u003e`)` [Action](https://docs.gradle.org/current/javadoc/org/gradle/api/Action.html) based version of [finalizeDsl](#finalizeDsl(kotlin.Function1)) above. |\n\nPublic methods\n--------------\n\n### finalizeDsl\n\n```\nabstract fun finalizeDsl(callback: (T) -\u003e Unit): Unit\n```\n\nAPI to customize the DSL Objects programmatically after they have been evaluated from the\nbuild files and before used in the build process next steps like variant or tasks creation.\n\nExample of a build type creation: \n\n```text\nandroidComponents.finalizeDsl { extension -\u003e\n extension.buildTypes.create(\"extra\")\n}\n``` \n\n### finalizeDsl\n\n```\nabstract fun finalizeDsl(callback: Action\u003cT\u003e): Unit\n```\n\n[Action](https://docs.gradle.org/current/javadoc/org/gradle/api/Action.html) based version of [finalizeDsl](#finalizeDsl(kotlin.Function1)) above."]]