1page.title=Android Plugin for Gradle Release Notes
2
3@jd:body
4
5<div id="qv-wrapper">
6<div id="qv">
7
8  <h2>See also</h2>
9  <ol>
10     <li><a href="{@docRoot}sdk/installing/studio-build.html">Build System Overview</a></li>
11     <li><a href="{@docRoot}tools/building/plugin-for-gradle.html">Android Plugin for Gradle</a></li>
12  </ol>
13
14</div>
15</div>
16
17
18<p>The Android build system uses the Android Plugin for Gradle to support building Android
19applications with the <a href="http://www.gradle.org/">Gradle</a> build toolkit. The plugin runs
20independent of Android Studio so the plugin and the Gradle build system can be updated
21independently of Android Studio.</p>
22
23<p class="note"><strong>Note:</strong> When you update Android Studio or open a project in a
24previous version of Android Studio, Android Studio prompts you to automatically update the plugin
25and Gradle to the latest available versions. You can choose to accept these updates based
26on your project's build requirements. </p>
27
28
29<h2 id="revisions">Revisions</h2>
30
31<p>The sections below provide notes about successive releases of
32the Android Plugin for Gradle, as denoted by revision number. To determine what revision of the
33plugin you are using, check the version declaration in the project-level
34<strong>build.gradle</strong> file. </p>
35
36<p>For a summary of known issues in Android Plugin for Gradle, see <a
37href="http://tools.android.com/knownissues">http://tools.android.com/knownissues</a>.</p>
38
39
40<div class="toggle-content opened">
41  <p><a href="#" onclick="return toggleContent(this)">
42    <img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-content-img"
43      alt=""/>Android Plugin for Gradle, Revision 1.3.0</a> <em>(July 2015)</em>
44  </p>
45
46  <div class="toggle-content-toggleme">
47
48    <dl>
49    <dt>Dependencies:</dt>
50
51    <dd>
52      <ul>
53        <li>Gradle 2.2.1 or higher.</li>
54        <li>Build Tools 21.1.1 or higher.</li>
55      </ul>
56    </dd>
57
58    <dt>General Notes:</dt>
59    <dd>
60      <ul>
61      <li>Added support for the <code>com.android.build.threadPoolSize</code> property to control
62         the <code>Android</code> task thread pool size from the <code>gradle.properties</code> file
63         or the command line. The following example sets this property to 4.
64<pre>
65-Pcom.android.build.threadPoolSize=4
66</pre>
67      </li>
68      <li>Set the default build behavior to exclude <code>LICENSE</code> and <code>LICENSE.txt</code>
69        files from APKs. To include these files in an APK, remove these files from the
70        <code>packagingOptions.excludes</code> property in the <code>build.gradle</code> file.
71        For example:
72<pre>
73android {
74      packagingOptions.excludes = []
75    }
76</pre>
77      </li>
78      <li>Added the <code>sourceSets</code> task to inspect the set of all available source sets. </li>
79      <li>Enhanced unit test support to recognize multi-flavor and
80        <a href="{@docRoot}tools/building/configuring-gradle.html#workBuildVariants">
81        build variant</a>  source folders. For example, to test an app with multi-flavors
82        <code>flavor1</code> and <code>flavorA</code> with the <code>Debug</code> build type,
83        the test source sets are:
84        <ul>
85          <li>test </li>
86          <li>testFlavor1 </li>
87          <li>testFlavorA </li>
88          <li>testFlavor1FlavorA </li>
89          <li>testFlavor1FlavorADebug </li>
90        </ul>
91        <p>Android tests already recognized multi-flavor source folders. </p> </li>
92      <li>Improved unit test support to:</p>
93        <ul>
94          <li>Run <code>javac</code> on main and test sources, even if the <code>useJack</code>
95            property is set to <code>true</code> in your build file. </li>
96          <li>Correctly recognize dependencies for each build type. </li>
97        </ul>
98      </li>
99      <li>Added support for specifying instrumentation test-runner arguments from the command line.
100        For example:
101<pre>
102./gradlew connectedCheck \
103   -Pandroid.testInstrumentationRunnerArguments.size=medium \
104   -Pandroid.testInstrumentationRunnerArguments.class=TestA,TestB
105</pre>
106      </li>
107      <li>Added support for arbitrary additional Android Asset Packaging Tool (AAPT) parameters
108        in the <code>build.gradle</code> file. For example:
109<pre>
110android {
111    aaptOptions {
112      additionalParameters "--custom_option", "value"
113    }
114}
115</pre>
116      </li>
117
118      <li>Added support for a <a href="{@docRoot}tools/studio/studio-features.html#test-module">
119        test APK module</a> as a separate test module, using the
120        <code>targetProjectPath</code> and <code>targetVariant</code> properties to set the APK
121        path and target variant.
122         <p class="note"><strong>Note:</strong> A test APK module does not support product
123          flavors and can only target a single variant. Also, Jacoco is not supported yet.</p>
124      </li>
125      <li>Added resource name validation before merging resources. </li>
126      <li>When building an AAR (Android ARchive) package for library modules, do not provide an
127        automatic <code>&#64;{applicationId}</code> placeholder in the
128        <a href="{@docRoot}tools/building/manifest-merge.html">manifest merger</a> settings.
129        Instead, use a different placeholder, such as <code>&#64;{libApplicationId}</code> and
130        provide a value for it if you want to include application Ids in the archive library.  </li>
131
132     </ul>
133    </dd>
134  </div>
135</div>
136
137
138
139
140<div class="toggle-content closed">
141  <p><a href="#" onclick="return toggleContent(this)">
142    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
143      alt=""/>Android Plugin for Gradle, Revision 1.2.0</a> <em>(April 2015)</em>
144  </p>
145
146  <div class="toggle-content-toggleme">
147
148    <dl>
149    <dt>Dependencies:</dt>
150
151    <dd>
152      <ul>
153        <li>Gradle 2.2.1 or higher.</li>
154        <li>Build Tools 21.1.1 or higher.</li>
155      </ul>
156    </dd>
157
158    <dt>General Notes:</dt>
159    <dd>
160      <ul>
161      <li>Enhanced support for running unit tests with Gradle.  </li>
162        <ul>
163          <li>Added support to include Java-style resources in the classpath when running unit
164            tests directly from Gradle.
165          </li>
166          <li>Added unit test dependency support for Android ARchive (AAR) artifacts.
167          </li>
168          <li>Added support for the <code>unitTestVariants</code> property so unit test variants
169            can be manipulated using the <code>build.gradle</code> file.
170          </li>
171          <li>Added the <code>unitTest.all</code> code block under <code>testOptions</code> to
172            configure customized tasks for unit test. The following sample code shows how to add
173            unit test configuration settings using this new option:
174<pre>
175android {
176  testOptions {
177    unitTest.all {
178      jvmArgs '-XX:MaxPermSize=256m' // Or any other gradle option.
179    }
180  }
181}
182</pre>
183           </li>
184          <li>Fixed the handling of enums and public instance fields in the packaging of the
185           <code>mockable-android.jar</code> file.
186          </li>
187          <li>Fixed library project task dependencies so test classes recompile after changes.
188          </li>
189          </ul>
190        <li>Added the <code>testProguardFile</code> property to apply
191          <a href="{@docRoot}tools/help/proguard.html">ProGuard</a> files when minifying a test APK.
192        </li>
193        <li>Added the <code>timeOut</code> property to the <code>adbOptions</code> code block
194          for setting the maximum recording time for
195          <a href="{@docRoot}tools/help/adb.html">Android Debug Bridge</a> screen recording.
196        </li>
197        <li>Added support for 280 dpi resources.
198        </li>
199        <li>Improved performance during project evaluation.
200        </li>
201     </ul>
202    </dd>
203  </div>
204</div>
205
206
207<div class="toggle-content closed">
208  <p><a href="#" onclick="return toggleContent(this)">
209    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
210      alt=""/>Android Plugin for Gradle, Revision 1.1.3</a> <em>(March 2015)</em>
211  </p>
212
213  <div class="toggle-content-toggleme">
214
215    <dl>
216    <dt>Dependencies:</dt>
217
218    <dd>
219      <ul>
220        <li>Gradle 2.2.1 or higher.</li>
221        <li>Build Tools 21.1.1 or higher.</li>
222      </ul>
223    </dd>
224
225    <dt>General Notes:</dt>
226    <dd>
227    <ul>
228      <li>Fixed issue with duplicated dependencies on a test app that triggered a ProGuard failure. </li>
229      <li>Fixed Comparator implementation which did not comply with the JDK Comparator contract and
230      generated a JDK 7 error.</li>
231    </ul>
232    </dd>
233  </div>
234</div>
235
236
237<div class="toggle-content closed">
238  <p><a href="#" onclick="return toggleContent(this)">
239    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
240      alt=""/>Android Plugin for Gradle, Revision 1.1.2</a> <em>(February 2015)</em>
241  </p>
242
243  <div class="toggle-content-toggleme">
244
245    <dl>
246    <dt>Dependencies:</dt>
247
248    <dd>
249      <ul>
250        <li>Gradle 2.2.1 or higher.</li>
251        <li>Build Tools 21.1.1 or higher.</li>
252      </ul>
253    </dd>
254
255    <dt>General Notes:</dt>
256    <dd>
257    <ul>
258      <li>Normalized path when creating a mockable JAR for unit testing. </li>
259      <li>Fixed the <code>archivesBaseName</code> setting in the <code>build.gradle</code> file. </li>
260      <li>Fixed the unresolved placeholder failure in manifest merger when building a library
261      test application.</li>
262    </ul>
263    </dd>
264  </div>
265</div>
266
267
268
269<div class="toggle-content closed">
270  <p><a href="#" onclick="return toggleContent(this)">
271    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
272      alt=""/>Android Plugin for Gradle, Revision 1.1.1</a> <em>(February 2015)</em>
273  </p>
274
275  <div class="toggle-content-toggleme">
276
277    <dl>
278    <dt>Dependencies:</dt>
279
280    <dd>
281      <ul>
282        <li>Gradle 2.2.1 or higher.</li>
283        <li>Build Tools 21.1.1 or higher.</li>
284      </ul>
285    </dd>
286
287    <dt>General Notes:</dt>
288    <dd>
289    <ul>
290      <li>Modified build variants so only variants that package a
291      <a href="{@docRoot}training/wearables/apps/index.html">Wear</a> app trigger Wear-specific
292      build tasks. </li>
293      <li>Changed dependency related issues to fail at build time rather than at debug time.
294      This behavior allows you to run diagnostic diagnostic tasks (such as 'dependencies') to help
295      resolve the conflict. </li>
296      <li>Fixed the <code>android.getBootClasspath()</code> method to return a value. </li>
297    </ul>
298    </dd>
299  </div>
300</div>
301
302
303
304
305
306<div class="toggle-content closed">
307  <p><a href="#" onclick="return toggleContent(this)">
308    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
309      alt=""/>Android Plugin for Gradle, Revision 1.1.0</a> <em>(February 2015)</em>
310  </p>
311
312  <div class="toggle-content-toggleme">
313
314    <dl>
315    <dt>Dependencies:</dt>
316
317    <dd>
318      <ul>
319        <li>Gradle 2.2.1 or higher.</li>
320        <li>Build Tools 21.1.1 or higher.</li>
321      </ul>
322    </dd>
323
324    <dt>General Notes:</dt>
325    <dd>
326    <ul>
327      <li>Added new unit test support</li>
328      <ul>
329       <li>Enabled
330       <a href="{@docRoot}training/activity-testing/activity-unit-testing.html">unit tests</a> to
331       run on the local JVM against a special version of the <code>android.jar</code> file that is
332       compatible with popular mocking frameworks, for example Mockito. </li>
333       <li>Added new test tasks <code>testDebug</code>, <code>testRelease</code>, and
334       <code>testMyFlavorDebug</code> when using product flavors. </li>
335       <li>Added new source folders recognized as unit tests: <code>src/test/java/</code>,
336       <code>src/testDebug/java/</code>, <code>src/testMyFlavor/java/</code>.
337       <li>Added new configurations in the <code>build.gradle</code> file for declaring test-only
338       dependencies, for example, <code>testCompile 'junit:junit:4.11'</code>,
339       <code>testMyFlavorCompile 'some:library:1.0'</code>.
340        <p class="note"><strong>Note:</strong> Test-only dependencies are not currently compatible
341        with Jack (Java Android Compiler Kit). </p>
342       </li>
343       <li>Added the <code>android.testOptions.unitTests.returnDefaultValues</code> option to
344       control the behaviour of the mockable android.jar. </li>
345      </ul>
346      <li>Replaced <code>Test</code> in test task names with <code>AndroidTest</code>.
347      For example, the <code>assembleDebugTest</code> task is now
348      <code>assembleDebugAndroidTest</code> task. Unit test tasks still have <code>UnitTest</code>
349      in the task name, for example <code>assembleDebugUnitTest</code>. </li>
350      <li>Modified <a href="{@docRoot}tools/help/proguard.html">ProGuard</a> configuration files to
351      no longer apply to the test APK. If minification is enabled, ProGuard processes the test APK
352      and applies only the mapping file that is generated when minifying the main APK. </li>
353      <li>Updated dependency management</li>
354       <ul>
355       <li>Fixed issues using <code>provided</code> and <code>package</code> scopes.
356         <p class="note"><strong>Note:</strong> These scopes are incompatible with AAR
357         (Android ARchive) packages and will cause a build with AAR packages to fail.</p>
358       </li>
359       <li>Modified dependency resolution to compare the dependencies of an app under test and the
360       test app. If an artifact with the same version is found for both apps, it's not included with
361       the test app and is packaged only with the app under test. If an artifact with a different
362       version is found for both apps, the build fails.</li>
363       </ul>
364
365      <li>Added support for <code>anyDpi</code>
366      <a href="{@docRoot}guide/topics/resources/providing-resources.html"> resource qualifier</a>
367      in resource merger. </li>
368      <li>Improved evaluation and IDE sync speeds for projects with a large number of
369      Android <a href="{@docRoot}sdk/installing/create-project.html#CreatingAModule"> modules</a>. </li>
370    </ul>
371    </dd>
372  </div>
373</div>
374
375
376<div class="toggle-content closed">
377  <p><a href="#" onclick="return toggleContent(this)">
378    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
379      alt=""/>Android Plugin for Gradle, Revision 1.0.1</a> <em>(January 2015)</em>
380  </p>
381
382  <div class="toggle-content-toggleme">
383
384    <dl>
385    <dt>Dependencies:</dt>
386
387    <dd>
388      <ul>
389        <li>Gradle 2.2.1 up to 2.3.x.
390        <p class="note"><strong>Note:</strong> This version of the Android Plugin for Gradle is
391        not compatible with Gradle 2.4 and higher. </p>
392        </li>
393        <li>Build Tools 21.1.1 or higher.</li>
394      </ul>
395    </dd>
396
397    <dt>General Notes:</dt>
398    <dd>
399    <ul>
400      <li>Fixed issue with Gradle build failure when accessing the
401      <code>extractReleaseAnnotations</code> module.
402      (<a href="http://b.android.com/81638">Issue 81638</a>).</li>
403      <li>Fixed issue with <code>Disable</code> passing the
404      <code>--no-optimize</code> setting to the Dalvik Executable (dex) bytecode.
405      (<a href="http://b.android.com/82662">Issue 82662</a>).</li>
406      <li>Fixed manifest merger issues when importing libraries with a
407      <code>targetSdkVersion</code> less than 16.</li>
408      <li>Fixed density ordering issue when using Android Studio with JDK 8.</li>
409    </ul>
410    </dd>
411  </div>
412</div>
413
414
415
416
417<div class="toggle-content closed">
418  <p><a href="#" onclick="return toggleContent(this)">
419    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
420      alt=""/>Android Plugin for Gradle, Revision 1.0.0</a> <em>(December 2014)</em>
421  </p>
422
423  <div class="toggle-content-toggleme">
424
425    <dl>
426    <dt>Dependencies:</dt>
427
428    <dd>
429      <ul>
430        <li>Gradle 2.2.1 up to 2.3.x.
431        <p class="note"><strong>Note:</strong> This version of the Android Plugin for Gradle is
432        not compatible with Gradle 2.4 and higher. </p>
433        </li>
434        <li>Build Tools 21.1.1 or higher.</li>
435      </ul>
436    </dd>
437
438    <dt>General Notes:</dt>
439    <dd>
440      <ul>
441        <li>Initial plugin release.</li>
442      </ul>
443    </dd>
444  </div>
445</div>
446
447
448
449
450<h2>Updating the Android Plugin for Gradle Version</h2>
451<p>The Android Plugin for Gradle version is specified in the
452<strong>File &gt; Project Structure</strong> menu or the project-level
453<code>build.gradle</code> file. The plugin version applies to all modules built in that
454Android Studio project. This example updates the Android Plugin for Gradle to version 1.1.0:
455<pre>
456...
457     dependencies {
458         classpath 'com.android.tools.build:gradle:1.1.0'
459     }
460...
461</pre>
462
463
464<p class="caution"><strong>Caution:</strong> You should not use dynamic dependencies (+) in
465version numbers. Using this feature can cause unexpected version updates and difficulty
466resolving version differences. </p>
467
468<p>If you're building with Gradle but using not Android Studio, the build process downloads the
469latest Android Plugin for Gradle plugin when it runs. </p>
470
471
472
473<h2>Updating the Gradle Version </h2>
474
475<p>Android Studio requires Gradle version 2.2.1 or later. To view and
476update the Gradle version, edit the Gradle distribution reference in the
477<code>gradle/wrapper/gradle-wrapper.properties</code> file. This example shows the
478Android Plugin for Gradle version set to 2.2.1.</p>
479
480<pre>
481...
482distributionUrl=http\://services.gradle.org/distributions/gradle-2.2.1-all.zip
483...
484</pre>
485
486
487
488
489<p>For more details about the supported Android Plugin for Gradle properties and syntax, click
490the link to the
491<a href="{@docRoot}tools/building/plugin-for-gradle.html">Plugin Language Reference</a>.</p>
492
493
494
495
496
497