Interface Variant


public interface Variant
A build Variant. This is the combination of a Build Type and 0+ Product Flavors (exactly one for each existing Flavor Dimension). Build Types and Flavors both contribute source folders, so this Variant is the direct representation of a set of source folders (and configuration parameters) used to build something. However the output of a Variant is not a single item. First there can be several artifacts. - Main Artifact: this is the main Android output(s). The app or the library being generated. - Extra Android Artifacts: these are ancillary artifacts, most likely test app(s). - Extra Java artifacts: these are pure-Java ancillary artifacts (junit support for instance).
  • Method Details

    • getName

      @NonNull String getName()
      Returns the name of the variant. It is made up of the build type and flavors (if applicable)
      Returns:
      the name of the variant.
    • getDisplayName

      @NonNull String getDisplayName()
      Returns a display name for the variant. It is made up of the build type and flavors (if applicable)
      Returns:
      the name.
    • getMainArtifact

      @NonNull AndroidArtifact getMainArtifact()
      Returns the main artifact for this variant.
      Returns:
      the artifact.
    • getExtraAndroidArtifacts

      @NonNull Collection<AndroidArtifact> getExtraAndroidArtifacts()
    • getExtraJavaArtifacts

      @NonNull Collection<JavaArtifact> getExtraJavaArtifacts()
    • getBuildType

      @NonNull String getBuildType()
      Returns the build type. All variants have a build type, so this is never null.
      Returns:
      the name of the build type.
    • getProductFlavors

      @NonNull List<String> getProductFlavors()
      Returns the flavors for this variants. This can be empty if no flavors are configured.
      Returns:
      a list of flavors which can be empty.
    • getMergedFlavor

      @NonNull com.android.builder.model.ProductFlavor getMergedFlavor()
      The result of the merge of all the flavors and of the main default config. If no flavors are defined then this is the same as the default config. This is directly a ProductFlavor instance of a ProductFlavorContainer since this a composite of existing ProductFlavors.
      Returns:
      the merged flavors.
      See Also:
    • getTestedTargetVariants

      @NonNull Collection<TestedTargetVariant> getTestedTargetVariants()
      Returns the list of target projects and the variants that this variant is testing. This is specified for the test only variants (ones using the test plugin).
      Returns:
      all tested variants
    • isInstantAppCompatible

      boolean isInstantAppCompatible()
      Returns true if this variant is instant app compatible, intended to be possibly built and served in an instant app context. This is populated during sync from the project's manifest. Only application modules and dynamic feature modules will set this property.
      Returns:
      true if this variant is instant app compatible
      Since:
      3.3
    • getDesugaredMethods

      @NonNull List<String> getDesugaredMethods()
      Returns all desugared methods including backported methods handled by D8 and methods provided by core library desugaring. Only D8 backported methods are returned if coreLibraryDesugaring is disabled or we are not able to find expected lint files from the dependency of coreLibraryDesugaring configuration.
      Returns:
      all desugared methods
      Since:
      4.1