blob: 90ec44a32b41f986f4ddaffc507fe263c7a2cef5 [file] [log] [blame]
page.title=Android Plugin for Gradle Release Notes
@jd:body
<div id="qv-wrapper">
<div id="qv">
<h2>See also</h2>
<ol>
<li><a href="{@docRoot}sdk/installing/studio-build.html">Build System Overview</a></li>
<li><a href="{@docRoot}tools/building/plugin-for-gradle.html">Android Plugin for Gradle</a></li>
</ol>
</div>
</div>
<p>The Android build system uses the Android Plugin for Gradle to support building Android
applications with the <a href="http://www.gradle.org/">Gradle</a> build toolkit. The plugin runs
independent of Android Studio so the plugin and the Gradle build system can be updated
independently of Android Studio.</p>
<p class="note"><strong>Note:</strong> 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. </p>
<h2 id="revisions">Revisions</h2>
<p>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
<strong>build.gradle</strong> file. </p>
<p>For a summary of known issues in Android Plugin for Gradle, see <a
href="http://tools.android.com/knownissues">http://tools.android.com/knownissues</a>.</p>
<div class="toggle-content opened">
<p><a href="#" onclick="return toggleContent(this)">
<img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-content-img"
alt=""/>Android Plugin for Gradle, Revision 1.2.0</a> <em>(April 2015)</em>
</p>
<div class="toggle-content-toggleme">
<dl>
<dt>Dependencies:</dt>
<dd>
<ul>
<li>Gradle 2.2.1 or higher.</li>
<li>Build Tools 21.1.1 or higher.</li>
</ul>
</dd>
<dt>General Notes:</dt>
<dd>
<ul>
<li>Enhanced support for running unit tests with Gradle. </li>
<ul>
<li>Added support to include Java-style resources in the classpath when running unit
tests directly from Gradle.
</li>
<li>Added unit test dependency support for Android ARchive (AAR) artifacts.
</li>
<li>Added support for the <code>unitTestVariants</code> property so unit test variants
can be manipulated using the <code>build.gradle</code> file.
</li>
<li>Added the <code>unitTest.all</code> code block under <code>testOptions</code> to
configure customized tasks for unit test. The following sample code shows how to add
unit test configuration settings using this new option:
<pre>
android {
testOptions {
unitTest.all {
jvmArgs '-XX:MaxPermSize=256m' // Or any other gradle option.
}
}
}
</pre>
</li>
<li>Fixed the handling of enums and public instance fields in the packaging of the
<code>mockable-android.jar</code> file.
</li>
<li>Fixed library project task dependencies so test classes recompile after changes.
</li>
</ul>
<li>Added the <code>testProguardFile</code> property to apply
<a href="{@docRoot}tools/help/proguard.html">ProGuard</a> files when minifying a test APK.
</li>
<li>Added the <code>timeOut</code> property to the <code>adbOptions</code> code block
for setting the maximum recording time for
<a href="{@docRoot}tools/help/adb.html">Android Debug Bridge</a> screen recording.
</li>
<li>Added support for 280 dpi resources.
</li>
<li>Improved performance during project evaluation.
</li>
</ul>
</dd>
</div>
</div>
<div class="toggle-content closed">
<p><a href="#" onclick="return toggleContent(this)">
<img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
alt=""/>Android Plugin for Gradle, Revision 1.1.3</a> <em>(March 2015)</em>
</p>
<div class="toggle-content-toggleme">
<dl>
<dt>Dependencies:</dt>
<dd>
<ul>
<li>Gradle 2.2.1 or higher.</li>
<li>Build Tools 21.1.1 or higher.</li>
</ul>
</dd>
<dt>General Notes:</dt>
<dd>
<ul>
<li>Fixed issue with duplicated dependencies on a test app that triggered a ProGuard failure. </li>
<li>Fixed Comparator implementation which did not comply with the JDK Comparator contract and
generated a JDK 7 error.</li>
</ul>
</dd>
</div>
</div>
<div class="toggle-content closed">
<p><a href="#" onclick="return toggleContent(this)">
<img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
alt=""/>Android Plugin for Gradle, Revision 1.1.2</a> <em>(February 2015)</em>
</p>
<div class="toggle-content-toggleme">
<dl>
<dt>Dependencies:</dt>
<dd>
<ul>
<li>Gradle 2.2.1 or higher.</li>
<li>Build Tools 21.1.1 or higher.</li>
</ul>
</dd>
<dt>General Notes:</dt>
<dd>
<ul>
<li>Normalized path when creating a mockable JAR for unit testing. </li>
<li>Fixed the <code>archivesBaseName</code> setting in the <code>build.gradle</code> file. </li>
<li>Fixed the unresolved placeholder failure in manifest merger when building a library
test application.</li>
</ul>
</dd>
</div>
</div>
<div class="toggle-content closed">
<p><a href="#" onclick="return toggleContent(this)">
<img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
alt=""/>Android Plugin for Gradle, Revision 1.1.1</a> <em>(February 2015)</em>
</p>
<div class="toggle-content-toggleme">
<dl>
<dt>Dependencies:</dt>
<dd>
<ul>
<li>Gradle 2.2.1 or higher.</li>
<li>Build Tools 21.1.1 or higher.</li>
</ul>
</dd>
<dt>General Notes:</dt>
<dd>
<ul>
<li>Modified build variants so only variants that package a
<a href="{@docRoot}training/wearables/apps/index.html">Wear</a> app trigger Wear-specific
build tasks. </li>
<li>Changed dependency related issues to fail at build time rather than at debug time.
This behavior allows you to run diagnostic diagnostic tasks (such as 'dependencies') to help
resolve the conflict. </li>
<li>Fixed the <code>android.getBootClasspath()</code> method to return a value. </li>
</ul>
</dd>
</div>
</div>
<div class="toggle-content closed">
<p><a href="#" onclick="return toggleContent(this)">
<img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
alt=""/>Android Plugin for Gradle, Revision 1.1.0</a> <em>(February 2015)</em>
</p>
<div class="toggle-content-toggleme">
<dl>
<dt>Dependencies:</dt>
<dd>
<ul>
<li>Gradle 2.2.1 or higher.</li>
<li>Build Tools 21.1.1 or higher.</li>
</ul>
</dd>
<dt>General Notes:</dt>
<dd>
<ul>
<li>Added new unit test support</li>
<ul>
<li>Enabled
<a href="{@docRoot}training/activity-testing/activity-unit-testing.html">unit tests</a> to
run on the local JVM against a special version of the <code>android.jar</code> file that is
compatible with popular mocking frameworks, for example Mockito. </li>
<li>Added new test tasks <code>testDebug</code>, <code>testRelease</code>, and
<code>testMyFlavorDebug</code> when using product flavors. </li>
<li>Added new source folders recognized as unit tests: <code>src/test/java/</code>,
<code>src/testDebug/java/</code>, <code>src/testMyFlavor/java/</code>.
<li>Added new configurations in the <code>build.gradle</code> file for declaring test-only
dependencies, for example, <code>testCompile 'junit:junit:4.11'</code>,
<code>testMyFlavorCompile 'some:library:1.0'</code>.
<p class="note"><strong>Note:</strong> Test-only dependencies are not currently compatible
with Jack (Java Android Compiler Kit). </p>
</li>
<li>Added the <code>android.testOptions.unitTests.returnDefaultValues</code> option to
control the behaviour of the mockable android.jar. </li>
</ul>
<li>Replaced <code>Test</code> in test task names with <code>AndroidTest</code>.
For example, the <code>assembleDebugTest</code> task is now
<code>assembleDebugAndroidTest</code> task. Unit test tasks still have <code>UnitTest</code>
in the task name, for example <code>assembleDebugUnitTest</code>. </li>
<li>Modified <a href="{@docRoot}tools/help/proguard.html">ProGuard</a> configuration files to
no longer apply to the test APK. If minification is enabled, ProGuard processes the test APK
and applies only the mapping file that is generated when minifying the main APK. </li>
<li>Updated dependency management</li>
<ul>
<li>Fixed issues using <code>provided</code> and <code>package</code> scopes.
<p class="note"><strong>Note:</strong> These scopes are incompatible with AAR
(Android ARchive) packages and will cause a build with AAR packages to fail.</p>
</li>
<li>Modified dependency resolution to compare the dependencies of an app under test and the
test app. If an artifact with the same version is found for both apps, it's not included with
the test app and is packaged only with the app under test. If an artifact with a different
version is found for both apps, the build fails.</li>
</ul>
<li>Added support for <code>anyDpi</code>
<a href="{@docRoot}guide/topics/resources/providing-resources.html"> resource qualifier</a>
in resource merger. </li>
<li>Improved evaluation and IDE sync speeds for projects with a large number of
Android <a href="{@docRoot}sdk/installing/create-project.html#CreatingAModule"> modules</a>. </li>
</ul>
</dd>
</div>
</div>
<div class="toggle-content closed">
<p><a href="#" onclick="return toggleContent(this)">
<img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
alt=""/>Android Plugin for Gradle, Revision 1.0.1</a> <em>(January 2015)</em>
</p>
<div class="toggle-content-toggleme">
<dl>
<dt>Dependencies:</dt>
<dd>
<ul>
<li>Gradle 2.2.1 up to 2.3.x.
<p class="note"><strong>Note:</strong> This version of the Android Plugin for Gradle is
not compatible with Gradle 2.4 and higher. </p>
</li>
<li>Build Tools 21.1.1 or higher.</li>
</ul>
</dd>
<dt>General Notes:</dt>
<dd>
<ul>
<li>Fixed issue with Gradle build failure when accessing the
<code>extractReleaseAnnotations</code> module.
(<a href="http://b.android.com/81638">Issue 81638</a>).</li>
<li>Fixed issue with <code>Disable</code> passing the
<code>--no-optimize</code> setting to the Dalvik Executable (dex) bytecode.
(<a href="http://b.android.com/82662">Issue 82662</a>).</li>
<li>Fixed manifest merger issues when importing libraries with a
<code>targetSdkVersion</code> less than 16.</li>
<li>Fixed density ordering issue when using Android Studio with JDK 8.</li>
</ul>
</dd>
</div>
</div>
<div class="toggle-content closed">
<p><a href="#" onclick="return toggleContent(this)">
<img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
alt=""/>Android Plugin for Gradle, Revision 1.0.0</a> <em>(December 2014)</em>
</p>
<div class="toggle-content-toggleme">
<dl>
<dt>Dependencies:</dt>
<dd>
<ul>
<li>Gradle 2.2.1 up to 2.3.x.
<p class="note"><strong>Note:</strong> This version of the Android Plugin for Gradle is
not compatible with Gradle 2.4 and higher. </p>
</li>
<li>Build Tools 21.1.1 or higher.</li>
</ul>
</dd>
<dt>General Notes:</dt>
<dd>
<ul>
<li>Initial plugin release.</li>
</ul>
</dd>
</div>
</div>
<h2>Updating the Android Plugin for Gradle Version</h2>
<p>The Android Plugin for Gradle version is specified in the
<strong>File &gt; Project Structure</strong> menu or the project-level
<code>build.gradle</code> 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:
<pre>
...
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
}
...
</pre>
<p class="caution"><strong>Caution:</strong> You should not use dynamic dependencies (+) in
version numbers. Using this feature can cause unexpected version updates and difficulty
resolving version differences. </p>
<p>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. </p>
<h2>Updating the Gradle Version </h2>
<p>Android Studio requires Gradle version 2.2.1 or later. To view and
update the Gradle version, edit the Gradle distribution reference in the
<code>gradle/wrapper/gradle-wrapper.properties</code> file. This example shows the
Android Plugin for Gradle version set to 2.2.1.</p>
<pre>
...
distributionUrl=http\://services.gradle.org/distributions/gradle-2.2.1-all.zip
...
</pre>
<p>For more details about the supported Android Plugin for Gradle properties and syntax, click
the link to the
<a href="{@docRoot}tools/building/plugin-for-gradle.html">Plugin Language Reference</a>.</p>