ApplicationBuildType

public interface ApplicationBuildType extends BuildType, ApplicationVariantDimension


Build types define certain properties that Gradle uses when building and packaging your app, and are typically configured for different stages of your development lifecycle.

There are two build types defined by default, debug and release, and you can customize them and create additional build types.

The default debug build type enables debug options and signs the APK with the debug key, while the release build type is not debuggable and can be configured to shrink, obfuscate, and sign your APK with a release key for distribution.

See configuring build types for more information.

Summary

Public methods

abstract Boolean

Whether to crunch PNGs.

abstract boolean

Whether this build type should generate a debuggable apk.

abstract boolean

Whether this product flavor should be selected in Studio by default

abstract boolean

Whether a linked Android Wear app should be embedded in variant using this build type.

abstract boolean

Intended to produce an APK that leads to more accurate profiling.

abstract void
setCrunchPngs(Boolean isCrunchPngs)

Whether to crunch PNGs.

abstract void
setDebuggable(boolean isDebuggable)

Whether this build type should generate a debuggable apk.

abstract void
setDefault(boolean isDefault)

Whether this product flavor should be selected in Studio by default

abstract void
setEmbedMicroApp(boolean isEmbedMicroApp)

Whether a linked Android Wear app should be embedded in variant using this build type.

abstract void
setProfileable(boolean isProfileable)

Intended to produce an APK that leads to more accurate profiling.

Inherited methods

From com.android.build.api.dsl.ApplicationVariantDimension
abstract String

Application id suffix.

abstract Boolean

Returns whether multi-dex is enabled.

abstract ApkSigningConfig

The associated signing config or null if none are set on the variant dimension.

abstract String

Version name suffix.

abstract void
setApplicationIdSuffix(String applicationIdSuffix)

Application id suffix.

abstract void
setMultiDexEnabled(Boolean multiDexEnabled)

Returns whether multi-dex is enabled.

abstract void

The associated signing config or null if none are set on the variant dimension.

abstract void
setVersionNameSuffix(String versionNameSuffix)

Version name suffix.

From com.android.build.api.dsl.BuildType
abstract boolean

Specifies code coverage is enabled for module tests of type AndroidTest.

abstract boolean

Specifies unit test code coverage data collection by configuring the JacocoPlugin.

abstract @NonNull List<@NonNull String>

Specifies a sorted list of build types that the plugin should try to use when a direct variant match with a local module dependency is not possible.

abstract @NonNull PostProcessing
abstract int

Optimization level to use by the renderscript compiler.

abstract void

Copies all properties from the given build type.

abstract boolean

Whether this build type is configured to generate an APK with debuggable native code.

abstract boolean

Specifies whether to enable code shrinking for this build type.

abstract boolean

Specifies whether the plugin should generate resources for pseudolocales.

abstract boolean

Whether the build type is configured to generate an apk with debuggable RenderScript code.

abstract boolean

Specifies whether to enable shrinking resources for this build type.

abstract boolean

Whether test coverage is enabled for this build type.

abstract boolean
abstract void
abstract void
setEnableAndroidTestCoverage(boolean enableAndroidTestCoverage)

Specifies code coverage is enabled for module tests of type AndroidTest.

abstract void
setEnableUnitTestCoverage(boolean enableUnitTestCoverage)

Specifies unit test code coverage data collection by configuring the JacocoPlugin.

abstract void
setJniDebuggable(boolean isJniDebuggable)

Whether this build type is configured to generate an APK with debuggable native code.

abstract void

This method is deprecated. Replaced with property matchingFallbacks

abstract void

This method is deprecated. Replaced with property matchingFallbacks

abstract void
setMinifyEnabled(boolean isMinifyEnabled)

Specifies whether to enable code shrinking for this build type.

abstract void
setPseudoLocalesEnabled(boolean isPseudoLocalesEnabled)

Specifies whether the plugin should generate resources for pseudolocales.

abstract void
setRenderscriptDebuggable(boolean isRenderscriptDebuggable)

Whether the build type is configured to generate an apk with debuggable RenderScript code.

abstract void
setRenderscriptOptimLevel(int renderscriptOptimLevel)

Optimization level to use by the renderscript compiler.

abstract void
setShrinkResources(boolean isShrinkResources)

Specifies whether to enable shrinking resources for this build type.

abstract void
setTestCoverageEnabled(boolean isTestCoverageEnabled)

Whether test coverage is enabled for this build type.

abstract void
setZipAlignEnabled(boolean isZipAlignEnabled)
From org.gradle.api.plugins.ExtensionAware
From org.gradle.api.Named
abstract @NonNull String
From com.android.build.api.dsl.VariantDimension
abstract void
addManifestPlaceholders(
    @NonNull Map<@NonNull String, @NonNull Object> manifestPlaceholders
)

Adds manifest placeholders.

abstract void
buildConfigField(
    @NonNull String type,
    @NonNull String name,
    @NonNull String value
)

Adds a new field to the generated BuildConfig class.

abstract void

Encapsulates per-variant CMake and ndk-build configurations for your external native build.

abstract @NonNull ExternalNativeBuildFlags

Encapsulates per-variant CMake and ndk-build configurations for your external native build.

abstract @NonNull JavaCompileOptions

Options for configuring Java compilation.

abstract @NonNull Map<@NonNull String, @NonNull Object>

The manifest placeholders.

abstract File

Text file that specifies additional classes that will be compiled into the main dex file.

abstract File

Text file with additional ProGuard rules to be used to determine which classes are compiled into the main dex file.

abstract @NonNull Ndk

Encapsulates per-variant configurations for the NDK, such as ABI filters.

abstract @NonNull Optimization
abstract @NonNull List<@NonNull File>

Specifies the ProGuard configuration files that the plugin should use.

abstract @NonNull Shaders

Options for configuring the shader compiler.

abstract @NonNull List<@NonNull File>

The collection of proguard rule files to be used when processing test code.

abstract void

Options for configuring Java compilation.

abstract void
ndk(@ExtensionFunctionType @NonNull Function1<@NonNull NdkUnit> action)

Encapsulates per-variant configurations for the NDK, such as ABI filters.

abstract void
abstract @NonNull Object
proguardFile(@NonNull Object proguardFile)

Adds a new ProGuard configuration file.

abstract @NonNull Object

Adds new ProGuard configuration files.

abstract void
resValue(@NonNull String type, @NonNull String name, @NonNull String value)

Adds a new generated resource.

abstract Void
setManifestPlaceholders(
    @NonNull Map<@NonNull String, @NonNull Object> manifestPlaceholders
)

This method is deprecated. Use manifestPlaceholders property instead

abstract void
setMultiDexKeepFile(File multiDexKeepFile)

Text file that specifies additional classes that will be compiled into the main dex file.

abstract void
setMultiDexKeepProguard(File multiDexKeepProguard)

Text file with additional ProGuard rules to be used to determine which classes are compiled into the main dex file.

abstract @NonNull Object
setProguardFiles(@NonNull Iterable<@NonNull ?> proguardFileIterable)

Replaces the ProGuard configuration files.

abstract void
shaders(
    @ExtensionFunctionType @NonNull Function1<@NonNull ShadersUnit> action
)

Configure the shader compiler options.

abstract @NonNull Object

Adds a proguard rule file to be used when processing test code.

abstract @NonNull Object

Adds proguard rule files to be used when processing test code.

Public methods

isCrunchPngs

abstract Boolean isCrunchPngs()

Whether to crunch PNGs.

Setting this property to true reduces of PNG resources that are not already optimally compressed. However, this process increases build times.

PNG crunching is enabled by default in the release build type and disabled by default in the debug build type.

isDebuggable

abstract boolean isDebuggable()

Whether this build type should generate a debuggable apk.

isDefault

abstract boolean isDefault()

Whether this product flavor should be selected in Studio by default

isEmbedMicroApp

abstract boolean isEmbedMicroApp()

Whether a linked Android Wear app should be embedded in variant using this build type.

Wear apps can be linked with the following code:

dependencies {
freeWearApp project(:wear:free') // applies to variant using the free flavor
wearApp project(':wear:base') // applies to all other variants
}

isProfileable

abstract boolean isProfileable()

Intended to produce an APK that leads to more accurate profiling.

Enabling this option will declare the application as profileable in the AndroidManifest.

Profileable build types will be signed with the default debug signing config if no other signing config is specified.

This option doesn't make sense to combine with isDebuggable=true. If a build type is set to be both debuggable and profileable the build system will log a warning.

setCrunchPngs

abstract void setCrunchPngs(Boolean isCrunchPngs)

Whether to crunch PNGs.

Setting this property to true reduces of PNG resources that are not already optimally compressed. However, this process increases build times.

PNG crunching is enabled by default in the release build type and disabled by default in the debug build type.

setDebuggable

abstract void setDebuggable(boolean isDebuggable)

Whether this build type should generate a debuggable apk.

setDefault

abstract void setDefault(boolean isDefault)

Whether this product flavor should be selected in Studio by default

setEmbedMicroApp

abstract void setEmbedMicroApp(boolean isEmbedMicroApp)

Whether a linked Android Wear app should be embedded in variant using this build type.

Wear apps can be linked with the following code:

dependencies {
freeWearApp project(:wear:free') // applies to variant using the free flavor
wearApp project(':wear:base') // applies to all other variants
}

setProfileable

abstract void setProfileable(boolean isProfileable)

Intended to produce an APK that leads to more accurate profiling.

Enabling this option will declare the application as profileable in the AndroidManifest.

Profileable build types will be signed with the default debug signing config if no other signing config is specified.

This option doesn't make sense to combine with isDebuggable=true. If a build type is set to be both debuggable and profileable the build system will log a warning.