summaryrefslogtreecommitdiffstats
path: root/docs/html/tools/revisions/gradle-plugin.jd
blob: ebca5c78c7a7a25c86411f6b7ff43874bdbcd421 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
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.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:
<pre>
...
     dependencies {
         classpath 'com.android.tools.build:gradle:1.1'
     }
...
</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>