Stay organized with collections
Save and categorize content based on your preferences.
VariantSelector
interface VariantSelector : VariantSelector
Summary
Public methods
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,["# VariantSelector\n===============\n\n```\ninterface VariantSelector : VariantSelector\n```\n\n|------------------------------------------------------|\n| [com.android.build.api.extension.VariantSelector](#) |\n\nSummary\n-------\n\n| ### Public methods ||\n|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [VariantSelector](#) | [all](#all())`()` Creates a [VariantSelector](#) of [ComponentIdentity](../component/ComponentIdentity.html#)that includes all the variants for the current module. |\n| abstract [VariantSelector](#) | [withBuildType](#withBuildType(kotlin.String))`(`buildType:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Returns a new selector for [ComponentIdentity](../component/ComponentIdentity.html#) objects with a given build type. |\n| abstract [VariantSelector](#) | [withFlavor](#withFlavor(kotlin.Pair))`(`flavorToDimension:` `[Pair](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-pair/index.html)\u003c[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html),` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)\u003e`)` Returns a new selector for [ComponentIdentity](../component/ComponentIdentity.html#) objects with a given (dimension, flavorName). |\n| abstract [VariantSelector](#) | [withName](#withName(java.util.regex.Pattern))`(`pattern:` `[Pattern](http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)`)` Returns a new selector for [ComponentIdentity](../component/ComponentIdentity.html#) objects with a given name pattern. |\n| abstract [VariantSelector](#) | [withName](#withName(kotlin.String))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Returns a new selector for [ComponentIdentity](../component/ComponentIdentity.html#) objects with a given name. |\n\nPublic methods\n--------------\n\n### all\n\n```\nabstract fun all(): VariantSelector\n```\n\nCreates a [VariantSelector](#) of [ComponentIdentity](../component/ComponentIdentity.html#)that includes all the variants for the\ncurrent module.\n\n| Return ||\n|---|---|\n| a [VariantSelector](#) for all variants. ||\n\n### withBuildType\n\n```\nabstract fun withBuildType(buildType: String): VariantSelector\n```\n\nReturns a new selector for [ComponentIdentity](../component/ComponentIdentity.html#) objects with a given build type.\n\n| Parameters ||\n|---------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------|\n| buildType: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | Build type to filter [ComponentIdentity](../component/ComponentIdentity.html#) on. |\n\n| Return ||\n|---|---|\n| An instance of [VariantSelector](#) to further filter variants. ||\n\n### withFlavor\n\n```\nabstract fun withFlavor(flavorToDimension: Pair\u003cString, String\u003e): VariantSelector\n```\n\nReturns a new selector for [ComponentIdentity](../component/ComponentIdentity.html#) objects with a given (dimension, flavorName).\n\n| Parameters ||\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|\n| flavorToDimension: [Pair](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-pair/index.html)\\\u003c[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html), [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)\\\u003e | Dimension and flavor to filter [ComponentIdentity](../component/ComponentIdentity.html#) on. |\n\n| Return ||\n|---|---|\n| [VariantSelector](#) instance to further filter instances of [ComponentIdentity](../component/ComponentIdentity.html#) ||\n\n### withName\n\n```\nabstract fun withName(pattern: Pattern): VariantSelector\n```\n\nReturns a new selector for [ComponentIdentity](../component/ComponentIdentity.html#) objects with a given name pattern.\n\n| Parameters ||\n|-------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| pattern: [Pattern](http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html) | [Pattern](http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html) to apply on the [org.gradle.api.Named.getName](https://docs.gradle.org/current/javadoc/org/gradle/api/Named.html#getName()) to filter [ComponentIdentity](../component/ComponentIdentity.html#) instances on |\n\n### withName\n\n```\nabstract fun withName(name: String): VariantSelector\n```\n\nReturns a new selector for [ComponentIdentity](../component/ComponentIdentity.html#) objects with a given name.\n\n| Parameters ||\n|----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| name: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) to test against the [org.gradle.api.Named.getName](https://docs.gradle.org/current/javadoc/org/gradle/api/Named.html#getName()) for equality. |"]]