Stay organized with collections
Save and categorize content based on your preferences.
LibraryBaseFlavor
@Incubating interface LibraryBaseFlavor<SigningConfigT : SigningConfig> : BaseFlavor, LibraryVariantDimension<SigningConfigT>
Summary
Inherited functions
|
From class LibraryVariantDimension
Unit |
aarMetadata(action: AarMetadata.() -> Unit)
Options for configuring AAR metadata.
|
Any |
consumerProguardFile(proguardFile: Any)
Adds a proguard rule file to be included in the published AAR.
This proguard rule file will then be used by any application project that consume 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.
This method has a return value for legacy reasons.
|
Any |
consumerProguardFiles(vararg proguardFiles: Any)
Adds proguard rule files to be included in the published AAR.
This proguard rule file will then be used by any application project that consume 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.
This method has a return value for legacy reasons.
|
|
From class VariantDimension
Unit |
addManifestPlaceholders(manifestPlaceholders: Map<String, Any>)
Adds manifest placeholders.
See
Inject Build Variables into the Manifest.
|
Unit |
addManifestPlaceholders(manifestPlaceholders: Map<String, Any>)
Adds manifest placeholders.
See
Inject Build Variables into the Manifest.
|
Unit |
buildConfigField(type: String, name: String, value: String)
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.
|
Unit |
buildConfigField(type: String, name: String, value: String)
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.
|
Unit |
externalNativeBuild(action: ExternalNativeBuildOptions.() -> Unit)
Encapsulates per-variant CMake and ndk-build configurations for your external native build.
To learn more, see
Add C and C++ Code to Your Project.
|
Unit |
externalNativeBuild(action: ExternalNativeBuildOptions.() -> Unit)
Encapsulates per-variant CMake and ndk-build configurations for your external native build.
To learn more, see
Add C and C++ Code to Your Project.
|
Unit |
javaCompileOptions(action: JavaCompileOptions.() -> Unit)
Options for configuring Java compilation.
|
Unit |
javaCompileOptions(action: JavaCompileOptions.() -> Unit)
Options for configuring Java compilation.
|
Unit |
ndk(action: Ndk.() -> Unit)
Encapsulates per-variant configurations for the NDK, such as ABI filters.
|
Unit |
ndk(action: Ndk.() -> Unit)
Encapsulates per-variant configurations for the NDK, such as ABI filters.
|
Any |
proguardFile(proguardFile: Any)
Adds a new ProGuard configuration file.
proguardFile getDefaultProguardFile('proguard-android.txt')
There are two ProGuard rules files that ship with the Android plugin and are used by
default:
- proguard-android.txt
- proguard-android-optimize.txt
proguard-android-optimize.txt is identical to proguard-android.txt ,
except with optimizations enabled. You can use getDefaultProguardFileString
to return the full path of the files.
This method has a return value for legacy reasons.
|
Any |
proguardFile(proguardFile: Any)
Adds a new ProGuard configuration file.
proguardFile getDefaultProguardFile('proguard-android.txt')
There are two ProGuard rules files that ship with the Android plugin and are used by
default:
- proguard-android.txt
- proguard-android-optimize.txt
proguard-android-optimize.txt is identical to proguard-android.txt ,
except with optimizations enabled. You can use getDefaultProguardFileString
to return the full path of the files.
This method has a return value for legacy reasons.
|
Any |
proguardFiles(vararg files: Any)
Adds new ProGuard configuration files.
There are two ProGuard rules files that ship with the Android plugin and are used by
default:
- proguard-android.txt
- proguard-android-optimize.txt
proguard-android-optimize.txt is identical to proguard-android.txt ,
except with optimizations enabled. You can use getDefaultProguardFileString
to return the full path of the files.
This method has a return value for legacy reasons.
|
Any |
proguardFiles(vararg files: Any)
Adds new ProGuard configuration files.
There are two ProGuard rules files that ship with the Android plugin and are used by
default:
- proguard-android.txt
- proguard-android-optimize.txt
proguard-android-optimize.txt is identical to proguard-android.txt ,
except with optimizations enabled. You can use getDefaultProguardFileString
to return the full path of the files.
This method has a return value for legacy reasons.
|
Unit |
resValue(type: String, name: String, value: String)
Adds a new generated resource.
This is equivalent to specifying a resource in res/values.
See Resource Types.
|
Unit |
resValue(type: String, name: String, value: String)
Adds a new generated resource.
This is equivalent to specifying a resource in res/values.
See Resource Types.
|
Unit |
shaders(action: Shaders.() -> Unit)
Configure the shader compiler options.
|
Unit |
shaders(action: Shaders.() -> Unit)
Configure the shader compiler options.
|
Any |
testProguardFile(proguardFile: Any)
Adds a proguard rule file to be used when processing test code.
Test code needs to be processed to apply the same obfuscation as was done to main code.
This method has a return value for legacy reasons.
|
Any |
testProguardFile(proguardFile: Any)
Adds a proguard rule file to be used when processing test code.
Test code needs to be processed to apply the same obfuscation as was done to main code.
This method has a return value for legacy reasons.
|
Any |
testProguardFiles(vararg proguardFiles: Any)
Adds proguard rule files to be used when processing test code.
Test code needs to be processed to apply the same obfuscation as was done to main code.
This method has a return value for legacy reasons.
|
Any |
testProguardFiles(vararg proguardFiles: Any)
Adds proguard rule files to be used when processing test code.
Test code needs to be processed to apply the same obfuscation as was done to main code.
This method has a return value for legacy reasons.
|
|
|
Inherited properties
|
From class LibraryVariantDimension
AarMetadata |
aarMetadata
Options for configuring AAR metadata.
|
MutableList<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.
|
Boolean? |
multiDexEnabled
Returns whether multi-dex is enabled.
This can be null if the flag is not set, in which case the default value is used.
|
SigningConfigT? |
signingConfig
The associated signing config or null if none are set on the variant dimension.
|
|
From class VariantDimension
ExternalNativeBuildOptions |
externalNativeBuild
Encapsulates per-variant CMake and ndk-build configurations for your external native build.
To learn more, see
Add C and C++ Code to Your Project.
|
ExternalNativeBuildOptions |
externalNativeBuild
Encapsulates per-variant CMake and ndk-build configurations for your external native build.
To learn more, see
Add C and C++ Code to Your Project.
|
JavaCompileOptions |
javaCompileOptions
Options for configuring Java compilation.
|
JavaCompileOptions |
javaCompileOptions
Options for configuring Java compilation.
|
MutableMap<String, Any> |
manifestPlaceholders
The manifest placeholders.
See
Inject Build Variables into the Manifest.
|
MutableMap<String, Any> |
manifestPlaceholders
The manifest placeholders.
See
Inject Build Variables into the Manifest.
|
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? |
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.
|
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.
|
Ndk |
ndk
Encapsulates per-variant configurations for the NDK, such as ABI filters.
|
Ndk |
ndk
Encapsulates per-variant configurations for the NDK, such as ABI filters.
|
MutableList<File> |
proguardFiles
Specifies the ProGuard configuration files that the plugin should use.
There are two ProGuard rules files that ship with the Android plugin and are used by
default:
- proguard-android.txt
- proguard-android-optimize.txt
proguard-android-optimize.txt is identical to proguard-android.txt ,
except with optimizations enabled. You can use getDefaultProguardFileString
to return the full path of the files.
|
MutableList<File> |
proguardFiles
Specifies the ProGuard configuration files that the plugin should use.
There are two ProGuard rules files that ship with the Android plugin and are used by
default:
- proguard-android.txt
- proguard-android-optimize.txt
proguard-android-optimize.txt is identical to proguard-android.txt ,
except with optimizations enabled. You can use getDefaultProguardFileString
to return the full path of the files.
|
Shaders |
shaders
Options for configuring the shader compiler.
|
Shaders |
shaders
Options for configuring the shader compiler.
|
MutableList<File> |
testProguardFiles
The collection of proguard rule files to be used when processing test code.
Test code needs to be processed to apply the same obfuscation as was done to main code.
|
MutableList<File> |
testProguardFiles
The collection of proguard rule files to be used when processing test code.
Test code needs to be processed to apply the same obfuscation as was done to main code.
|
|
From class BaseFlavor
Int? |
minSdk
The minimum SDK version.
Setting this it will override previous calls of minSdk and minSdkPreview setters. Only
one of minSdk and minSdkPreview should be set.
See uses-sdk element documentation.
|
String? |
minSdkPreview
The minimum SDK version.
Setting this it will override previous calls of minSdk and minSdkPreview setters. Only
one of minSdk and minSdkPreview should be set.
See uses-sdk element documentation.
|
Boolean? |
renderscriptNdkModeEnabled
Whether the renderscript code should be compiled to generate C/C++ bindings.
True for C/C++ generation, false for Java, null if not specified.
|
Boolean? |
renderscriptSupportModeBlasEnabled
Whether the renderscript BLAS support lib should be used to make it compatible with older
versions of Android.
True if BLAS support lib is enabled, false if not, and null if not specified.
|
Boolean? |
renderscriptSupportModeEnabled
Whether the renderscript code should be compiled in support mode to make it compatible with
older versions of Android.
True if support mode is enabled, false if not, and null if not specified.
|
Int? |
renderscriptTargetApi
The renderscript target api, or null if not specified. This is only the value set on this
product flavor.
|
MutableSet<String> |
resourceConfigurations
Specifies a list of
alternative resources
to keep.
For example, if you are using a library that includes language resources (such as
AppCompat or Google Play Services), then your APK includes all translated language strings
for the messages in those libraries whether the rest of your app is translated to the same
languages or not. If you'd like to keep only the languages that your app officially supports,
you can specify those languages using the resConfigs property, as shown in the
sample below. Any resources for languages not specified are removed.
android {
defaultConfig {
...
// Keeps language resources for only the locales specified below.
resConfigs "en", "fr"
}
}
You can also use this property to filter resources for screen densities. For example,
specifying hdpi removes all other screen density resources (such as mdpi ,
xhdpi , etc) from the final APK.
Note: auto is no longer supported because it created a number of
issues with multi-module projects. Instead, you should specify a list of locales that your
app supports, as shown in the sample above. Android plugin 3.1.0 and higher ignore the
auto argument, and Gradle packages all string resources your app and its dependencies
provide.
To learn more, see
Remove unused alternative resources.
|
String? |
testApplicationId
Test application ID.
See Set the Application ID
|
Boolean? |
testFunctionalTest
See instrumentation.
|
Boolean? |
testHandleProfiling
See instrumentation.
|
String? |
testInstrumentationRunner
Test instrumentation runner class name.
This is a fully qualified class name of the runner, e.g.
android.test.InstrumentationTestRunner
See instrumentation.
|
MutableMap<String, String> |
testInstrumentationRunnerArguments
Test instrumentation runner custom arguments.
e.g. [key: "value"] will give adb shell am instrument -w -e key value com.example ...
See instrumentation.
Test runner arguments can also be specified from the command line:
./gradlew connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.size=medium
./gradlew connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.foo=bar
|
VectorDrawables |
vectorDrawables
Options to configure the build-time support for vector drawables.
|
Boolean? |
wearAppUnbundled
Whether to enable unbundling mode for embedded wear app.
If true, this enables the app to transition from an embedded wear app to one
distributed by the play store directly.
|
|
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2020-10-12 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2020-10-12 UTC."],[],[]]