Stay organized with collections
Save and categorize content based on your preferences.
ApplicationPublishing
interface ApplicationPublishing : Publishing
Maven publishing DSL object for configuring options related to publishing APK and AAB.
This following code example creates a publication for the fullRelease build variant, which publish your app as Android App Bundle.
android {
// This project has four build variants: fullDebug, fullRelease, demoDebug, demoRelease
flavorDimensions 'mode'
productFlavors {
full {}
demo {}
}
publishing {
// Publish your app as an AAB
singleVariant("fullRelease")
}
}
afterEvaluate {
publishing {
publications {
fullRelease(MavenPublication) {
from components.fullRelease
// ......
}
}
}
}
To publish your app as a ZIP file of APKs, simply use the ApplicationSingleVariant.publishApk
as shown in the following example.
android {
publishing {
// Publish your app as a ZIP file of APKs
singleVariant("fullRelease") {
publishApk()
}
}
}
Summary
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,["# ApplicationPublishing\n=====================\n\n\n```\ninterface ApplicationPublishing : Publishing\n```\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nMaven publishing DSL object for configuring options related to publishing APK and AAB.\n\nThis following code example creates a publication for the fullRelease build variant, which publish your app as Android App Bundle. \n\n```gdscript\nandroid {\n // This project has four build variants: fullDebug, fullRelease, demoDebug, demoRelease\n flavorDimensions 'mode'\n productFlavors {\n full {}\n demo {}\n }\n\n publishing {\n // Publish your app as an AAB\n singleVariant(\"fullRelease\")\n }\n}\n\nafterEvaluate {\n publishing {\n publications {\n fullRelease(MavenPublication) {\n from components.fullRelease\n // ......\n }\n }\n }\n}\n```\n\nTo publish your app as a ZIP file of APKs, simply use the [ApplicationSingleVariant.publishApk](/reference/tools/gradle-api/7.4/com/android/build/api/dsl/ApplicationSingleVariant#publishApk()) as shown in the following example. \n\n```text\nandroid {\n publishing {\n // Publish your app as a ZIP file of APKs\n singleVariant(\"fullRelease\") {\n publishApk()\n }\n }\n}\n```\n\nSummary\n-------\n\n| ### Inherited functions ||\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| From class [com.android.build.api.dsl.Publishing](/reference/tools/gradle-api/7.4/com/android/build/api/dsl/Publishing) |------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [singleVariant](/reference/tools/gradle-api/7.4/com/android/build/api/dsl/Publishing#singleVariant(kotlin.String))`(variantName: `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Publish a variant with single variant publishing mechanism. | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [singleVariant](/reference/tools/gradle-api/7.4/com/android/build/api/dsl/Publishing#singleVariant(kotlin.String,kotlin.Function1))`(` ` variantName: `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`,` ` action: @`[ExtensionFunctionType](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html)` `[ApplicationSingleVariant](/reference/tools/gradle-api/7.4/com/android/build/api/dsl/ApplicationSingleVariant)`.() `-\u003e` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) `)` Publish a variant with single variant publishing options. | |"]]