page.title=Android Plugin for Gradle Release Notes @jd:body
The Android build system uses the Android Plugin for Gradle to support building Android applications with the Gradle build toolkit. The plugin runs independent of Android Studio so the plugin and the Gradle build system can be updated independently of Android Studio.
Note: When you update Android Studio or open a project in a previous version of Android Studio, Android Studio prompts you to automatically update the plugin and Gradle to the latest available versions. You can choose to accept these updates based on your project's build requirements.
The sections below provide notes about successive releases of the Android Plugin for Gradle, as denoted by revision number. To determine what revision of the plugin you are using, check the version declaration in the project-level build.gradle file.
For a summary of known issues in Android Plugin for Gradle, see http://tools.android.com/knownissues.
Android Plugin for Gradle, Revision 1.3.0 (July 2015)
com.android.build.threadPoolSize property to control
the Android task thread pool size from the gradle.properties file
or the command line. The following example sets this property to 4.
-Pcom.android.build.threadPoolSize=4
LICENSE and LICENSE.txt
files from APKs. To include these files in an APK, remove these files from the
packagingOptions.excludes property in the build.gradle file.
For example:
android {
packagingOptions.excludes = []
}
sourceSets task to inspect the set of all available source sets. flavor1 and flavorA with the Debug build type,
the test source sets are:
Android tests already recognized multi-flavor source folders.
javac on main and test sources, even if the useJack
property is set to true in your build file. ./gradlew connectedCheck \ -Pandroid.testInstrumentationRunnerArguments.size=medium \ -Pandroid.testInstrumentationRunnerArguments.class=TestA,TestB
build.gradle file. For example:
android {
aaptOptions {
additionalParameters "--custom_option", "value"
}
}
targetProjectPath and targetVariant properties to set the APK
path and target variant.
Note: A test APK module does not support product flavors and can only target a single variant. Also, Jacoco is not supported yet.
@{applicationId} placeholder in the
manifest merger settings.
Instead, use a different placeholder, such as @{libApplicationId} and
provide a value for it if you want to include application Ids in the archive library.
Android Plugin for Gradle, Revision 1.2.0 (April 2015)
unitTestVariants property so unit test variants
can be manipulated using the build.gradle file.
unitTest.all code block under testOptions to
configure customized tasks for unit test. The following sample code shows how to add
unit test configuration settings using this new option:
android {
testOptions {
unitTest.all {
jvmArgs '-XX:MaxPermSize=256m' // Or any other gradle option.
}
}
}
mockable-android.jar file.
testProguardFile property to apply
ProGuard files when minifying a test APK.
timeOut property to the adbOptions code block
for setting the maximum recording time for
Android Debug Bridge screen recording.
Android Plugin for Gradle, Revision 1.1.3 (March 2015)
Android Plugin for Gradle, Revision 1.1.2 (February 2015)
archivesBaseName setting in the build.gradle file.
Android Plugin for Gradle, Revision 1.1.1 (February 2015)
android.getBootClasspath() method to return a value.
Android Plugin for Gradle, Revision 1.1.0 (February 2015)
android.jar file that is
compatible with popular mocking frameworks, for example Mockito. testDebug, testRelease, and
testMyFlavorDebug when using product flavors. src/test/java/,
src/testDebug/java/, src/testMyFlavor/java/.
build.gradle file for declaring test-only
dependencies, for example, testCompile 'junit:junit:4.11',
testMyFlavorCompile 'some:library:1.0'.
Note: Test-only dependencies are not currently compatible with Jack (Java Android Compiler Kit).
android.testOptions.unitTests.returnDefaultValues option to
control the behaviour of the mockable android.jar. Test in test task names with AndroidTest.
For example, the assembleDebugTest task is now
assembleDebugAndroidTest task. Unit test tasks still have UnitTest
in the task name, for example assembleDebugUnitTest. provided and package scopes.
Note: These scopes are incompatible with AAR (Android ARchive) packages and will cause a build with AAR packages to fail.
anyDpi
resource qualifier
in resource merger.
Android Plugin for Gradle, Revision 1.0.1 (January 2015)
Note: This version of the Android Plugin for Gradle is not compatible with Gradle 2.4 and higher.
extractReleaseAnnotations module.
(Issue 81638).Disable passing the
--no-optimize setting to the Dalvik Executable (dex) bytecode.
(Issue 82662).targetSdkVersion less than 16.
Android Plugin for Gradle, Revision 1.0.0 (December 2014)
Note: This version of the Android Plugin for Gradle is not compatible with Gradle 2.4 and higher.
The Android Plugin for Gradle version is specified in the
File > Project Structure menu or the project-level
build.gradle file. The plugin version applies to all modules built in that
Android Studio project. This example updates the Android Plugin for Gradle to version 1.1.0:
...
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
}
...
Caution: You should not use dynamic dependencies (+) in version numbers. Using this feature can cause unexpected version updates and difficulty resolving version differences.
If you're building with Gradle but using not Android Studio, the build process downloads the latest Android Plugin for Gradle plugin when it runs.
Android Studio requires Gradle version 2.2.1 or later. To view and
update the Gradle version, edit the Gradle distribution reference in the
gradle/wrapper/gradle-wrapper.properties file. This example shows the
Android Plugin for Gradle version set to 2.2.1.
... distributionUrl=http\://services.gradle.org/distributions/gradle-2.2.1-all.zip ...
For more details about the supported Android Plugin for Gradle properties and syntax, click the link to the Plugin Language Reference.