DSL object to configure build types.
Property | Description |
applicationIdSuffix | Application id suffix applied to this build type. |
consumerProguardFiles | ProGuard rule files to be included in the published AAR. |
debuggable | Whether this build type should generate a debuggable apk. |
embedMicroApp | Whether a linked Android Wear app should be embedded in variant using this build type. |
jniDebuggable | Whether this build type is configured to generate an APK with debuggable native code. |
manifestPlaceholders | The manifest placeholders. |
minifyEnabled | Whether Minify is enabled for this build type. |
multiDexEnabled | Whether Multi-Dex is enabled for this variant. |
name | Name of this build type. |
proguardFiles | Returns ProGuard configuration files to be used. |
pseudoLocalesEnabled | Whether to generate pseudo locale in the APK. |
renderscriptDebuggable | Whether the build type is configured to generate an apk with debuggable RenderScript code. |
renderscriptOptimLevel | Optimization level to use by the renderscript compiler. |
shrinkResources | Whether shrinking of unused resources is enabled. Default is false; |
signingConfig | The signing configuration. |
testCoverageEnabled | Whether test coverage is enabled for this build type. |
useJack | Whether the experimental Jack toolchain should be used. |
versionNameSuffix | Version name suffix. |
zipAlignEnabled | Whether zipalign is enabled for this build type. |
Method | Description |
buildConfigField(type, name, value) | Adds a new field to the generated BuildConfig class. |
proguardFile(proguardFile) | Adds a new ProGuard configuration file. |
proguardFiles(proguardFileArray) | Adds new ProGuard configuration files. |
resValue(type, name, value) | Adds a new generated resource. |
resValue(type, name, value) | Adds a new generated resource. |
setProguardFiles(proguardFileIterable) | Sets the ProGuard configuration files. |
shrinkResources(flag) | Whether shrinking of unused resources is enabled. Default is false; |
useJack(useJack) | Whether the experimental Jack toolchain should be used. |
String
applicationIdSuffix
Application id suffix applied to this build type.
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.
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 }
Whether this build type is configured to generate an APK with debuggable native code.
Boolean
multiDexEnabled
Whether Multi-Dex is enabled for this variant.
String
name
(read-only)
Name of this build type.
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.
Whether to generate pseudo locale in the APK.
If enabled, 2 fake pseudo locales (en-XA and ar-XB) will be added to the APK to help test internationalization support in the app.
Whether the build type is configured to generate an apk with debuggable RenderScript code.
SigningConfig
signingConfig
(read-only)
The signing configuration.
Whether test coverage is enabled for this build type.
If enabled this uses Jacoco to capture coverage and creates a report in the build directory.
The version of Jacoco can be configured with:
android {
jacoco {
version = '0.6.2.201302030002'
}
}
Boolean
useJack
Whether the experimental Jack toolchain should be used.
String
versionNameSuffix
Version name suffix.
Adds a new field to the generated BuildConfig class.
The field is generated as: <type> <name> = <value>;
This means each of these must have valid Java content. If the type is a String, then the value should include quotes.
Adds a new ProGuard configuration file.
proguardFile getDefaultProguardFile('proguard-android.txt')
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.
Whether shrinking of unused resources is enabled. Default is false;
void
useJack
(Boolean
useJack)
Whether the experimental Jack toolchain should be used.