Enum Class AndroidGradlePluginProjectFlags.BooleanFlag

java.lang.Object
java.lang.Enum<AndroidGradlePluginProjectFlags.BooleanFlag>
com.android.builder.model.AndroidGradlePluginProjectFlags.BooleanFlag
All Implemented Interfaces:
Serializable, Comparable<AndroidGradlePluginProjectFlags.BooleanFlag>, Constable
Enclosing interface:
AndroidGradlePluginProjectFlags

public static enum AndroidGradlePluginProjectFlags.BooleanFlag extends Enum<AndroidGradlePluginProjectFlags.BooleanFlag>
Boolean flags for behavior changes in AGP that Android Studio needs to know about.

Studio uses the legacy default for AGPs that do not specifiy that flag.

Flags must never be removed from here. This is to avoid issues when the current version of studio fetches models from a project that has a legacy flag set. They can be marked as @Deprecated and the getter removed from IdeAndroidGradlePluginProjectFlags

  • Enum Constant Details

    • APPLICATION_R_CLASS_CONSTANT_IDS

      public static final AndroidGradlePluginProjectFlags.BooleanFlag APPLICATION_R_CLASS_CONSTANT_IDS
      Whether the R class in applications and dynamic features has constant IDs.

      If they are constant they can be inlined by the java compiler and used in places that require constants such as annotations and cases of switch statements.

    • TEST_R_CLASS_CONSTANT_IDS

      public static final AndroidGradlePluginProjectFlags.BooleanFlag TEST_R_CLASS_CONSTANT_IDS
      Whether the R class in instrumentation tests has constant IDs.

      If they are constant they can be inlined by the java compiler and used in places that require constants such as annotations and cases of switch statements.

    • TRANSITIVE_R_CLASS

      public static final AndroidGradlePluginProjectFlags.BooleanFlag TRANSITIVE_R_CLASS
      Whether the R class generated for this project is transitive.

      If it is transitive it will contain all of the resources defined in its transitive dependencies alongside those defined in this project. If non-transitive it will only contain the resources defined in this project.

    • JETPACK_COMPOSE

      public static final AndroidGradlePluginProjectFlags.BooleanFlag JETPACK_COMPOSE
      Whether the jetpack Compose feature is enabled for this project.
    • ML_MODEL_BINDING

      public static final AndroidGradlePluginProjectFlags.BooleanFlag ML_MODEL_BINDING
      Whether the ML model binding feature is enabled for this project.
    • UNIFIED_TEST_PLATFORM

      public static final AndroidGradlePluginProjectFlags.BooleanFlag UNIFIED_TEST_PLATFORM
      Whether the Android Test Platform is enabled for this project.
  • Method Details

    • values

      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getLegacyDefault

      public boolean getLegacyDefault()
      The apparent value of this flag from Studio if it is not explicitly set in the AGP model.

      As Studio can open projects from older Android Gradle Plugins this is used in IdeAndroidGradlePluginProjectFlags to supply a value if it was not supplied by the build system.

      This could be used because:

      1. The AGP version used does not support this model at all.
      2. The AGP version used supports this model but predates the introduction of this flag.
      3. The AGP version used supports this model and this flag but did not explicitly set a value for it.