DefaultBuildType

Properties

PropertyDescription
consumerProguardFiles

ProGuard rule files to be included in the published AAR.

manifestPlaceholders

The manifest placeholders.

multiDexEnabled

Whether Multi-Dex is enabled for this variant.

multiDexKeepFile

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

multiDexKeepProguard

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

proguardFiles

Returns ProGuard configuration files to be used.

Methods

MethodDescription
initWith(that)

Copies all properties from the given build type.

Script blocks

No script blocks

Property details

List<File> consumerProguardFiles

ProGuard rule files to be included in the published AAR.

These proguard rule files will then be used by any application project that consumes the AAR (if ProGuard is enabled).

This allows AAR to specify shrinking or obfuscation exclude rules.

This is only valid for Library project. This is ignored in Application project.

Map<String, Object> manifestPlaceholders

The manifest placeholders.

See Inject Build Variables into the Manifest.

Boolean multiDexEnabled

Whether Multi-Dex is enabled for this variant.

File multiDexKeepFile

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

Classes specified in the file are appended to the main dex classes computed using aapt.

If set, the file should contain one class per line, in the following format: com/example/MyClass.class

File multiDexKeepProguard

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

If set, rules from this file are used in combination with the default rules used by the build system.

List<File> proguardFiles

Returns ProGuard configuration files to be used.

There are 2 default rules files

  • proguard-android.txt
  • proguard-android-optimize.txt

They are located in the SDK. Using getDefaultProguardFile(String filename) will return the full path to the files. They are identical except for enabling optimizations.

See similarly named methods to specify the files.

Method details

DefaultBuildType initWith(BuildType that)

Copies all properties from the given build type.

It can be used like this:

android.buildTypes {
    customBuildType {
        initWith debug
            // customize...
        }
}