Skip to content

Commit f6f056c

Browse files
Xavier DucrohetAndroid (Google) Code Review
authored andcommitted
Merge "Update dev guide for new build system and new lib system."
2 parents 3013134 + 47ef0c9 commit f6f056c

File tree

10 files changed

+162
-86
lines changed

10 files changed

+162
-86
lines changed

docs/html/guide/developing/building/building-cmdline.jd

Lines changed: 69 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ parent.link=index.html
1818
<li><a href="#RunningOnEmulator">Running on the Emulator</a></li>
1919
<li><a href="#RunningOnDevice">Running on a Device</a></li>
2020
<li><a href="#Signing">Application Signing</a></li>
21+
<li><a href="#AntReference">Ant Command Reference</a></li>
2122
</ol>
2223
<h2>See also</h2>
2324
<ol>
@@ -58,11 +59,11 @@ Emulator</a></li>
5859

5960
<p class="note"><strong>Note:</strong> When installing JDK on Windows, the default is to install
6061
in the "Program Files" directory. This location will cause <code>ant</code> to fail, because of
61-
the space. To fix the problem, you can specify the JAVA_HOME variable like this:
62+
the space. To fix the problem, you can specify the JAVA_HOME variable like this:
6263
<pre>set JAVA_HOME=c:\Progra~1\Java\&lt;jdkdir&gt;</pre>
63-
64+
6465
<p>The easiest solution, however, is to install JDK in a non-space directory, for example:</p>
65-
66+
6667
<pre>c:\java\jdk1.6.0_02</pre>
6768

6869
<h2 id="DebugMode">Building in Debug Mode</h2>
@@ -141,7 +142,7 @@ ant release
141142

142143
<p>If you would like, you can configure the Android build script to automatically sign and align
143144
your application package. To do so, you must provide the path to your keystore and the name of
144-
your key alias in your project's {@code build.properties} file. With this information provided,
145+
your key alias in your project's {@code ant.properties} file. With this information provided,
145146
the build script will prompt you for your keystore and alias password when you build in release
146147
mode and produce your final application package, which will be ready for distribution.</p>
147148

@@ -152,7 +153,7 @@ ant release
152153
procedure manually, <a href="#ManualReleaseMode">build unsigned</a> and then continue with
153154
<a href="{@docRoot}guide/publishing/app-signing.html">Signing Your Applications</a>.</p>
154155

155-
<p>To specify your keystore and alias, open the project {@code build.properties} file (found in
156+
<p>To specify your keystore and alias, open the project {@code ant.properties} file (found in
156157
the root of the project directory) and add entries for {@code key.store} and {@code key.alias}.
157158
For example:</p>
158159
<pre>
@@ -180,16 +181,16 @@ ant release
180181

181182
<p>This creates your Android application .apk file inside the project <code>bin/</code>
182183
directory, named <code><em>&lt;your_project_name&gt;</em>-release.apk</code>. This .apk file has
183-
been signed with the private key specified in {@code build.properties} and aligned with {@code
184+
been signed with the private key specified in {@code ant.properties} and aligned with {@code
184185
zipalign}. It's ready for installation and distribution.</p>
185186

186187
<h3 id="OnceBuilt">Once built and signed in release mode</h3>
187188

188189
<p>Once you have signed your application with a private key, you can install and run it on an
189-
<a href="#RunningOnEmulator">emulator</a> or <a href="#RunningOnDevice">device</a>. You can
190-
also try installing it onto a device from a web server. Simply upload the signed .apk to a web
191-
site, then load the .apk URL in your Android web browser to download the application and begin
192-
installation. (On your device, be sure you have enabled
190+
<a href="#RunningOnEmulator">emulator</a> or <a href="#RunningOnDevice">device</a>. You can
191+
also try installing it onto a device from a web server. Simply upload the signed .apk to a web
192+
site, then load the .apk URL in your Android web browser to download the application and begin
193+
installation. (On your device, be sure you have enabled
193194
<em>Settings &gt; Applications &gt; Unknown sources</em>.)</p>
194195

195196
<h2 id="RunningOnEmulator">Running on the Emulator</h2>
@@ -260,10 +261,6 @@ adb -s emulator-5554 install <em>path/to/your/app</em>.apk
260261
device:</p>
261262

262263
<ul>
263-
<li>Ensure that your application is debuggable by setting the
264-
<code>android:debuggable</code> attribute of the <code>&lt;application&gt;</code>
265-
element to <code>true</code>. As of ADT 8.0, this is done by default when you build in debug mode.</li>
266-
267264
<li>Enable USB Debugging on your device. You can find the setting on most Android devices by
268265
going to <strong>Settings > Applications > Development > USB debugging</strong>.</li>
269266

@@ -276,7 +273,7 @@ adb -s emulator-5554 install <em>path/to/your/app</em>.apk
276273
<p>Once your device is set up and connected via USB, navigate to your SDK's <code>platform-tools/</code>
277274
directory and install the <code>.apk</code> on the device:</p>
278275
<pre>
279-
adb -d install <em>path/to/your/app</em>.apk
276+
adb -d install <em>path/to/your/app</em>.apk
280277
</pre>
281278

282279
<p>The {@code -d} flag specifies that you want to use the attached device (in case you also have
@@ -315,4 +312,60 @@ adb -d install <em>path/to/your/app</em>.apk
315312
<p>Please read <a href="{@docRoot}guide/publishing/app-signing.html">Signing Your
316313
Applications</a>, which provides a thorough guide to application signing on Android and what it
317314
means to you as an Android application developer. The document also includes a guide to exporting
318-
and signing your application with the ADT's Export Wizard.</p>
315+
and signing your application with the ADT's Export Wizard.</p>
316+
317+
<h2 id="AntReference">Ant Command Reference</h2>
318+
<dt><code>ant clean</code></dt>
319+
<dd>Cleans the project. If you include the <code>all</code> target before <code>clean</code>
320+
(<code>ant all clean</code>), other projects are also cleaned. For instance if you clean a
321+
test project, the tested project is also cleaned.</dd>
322+
323+
<dt><code>ant debug</code></dt>
324+
<dd>Builds a debug package. Works on application, library, and test projects and compiles
325+
dependencies as needed.</dd>
326+
327+
<dt id="emma"><code>ant emma debug</code></dt>
328+
<dd>Builds a test project while building the tested project with instrumentation turned on.
329+
This is used to run tests with code coverage enabled.</dd>
330+
331+
<dt><code>ant release</code></dt>
332+
<dd>Builds a release package.</dd>
333+
334+
<dt><code>ant instrument</code>
335+
</dt>
336+
<dd>Builds an instrumented debug package. This is generally called automatically when building a
337+
test project with code coverage enabled (with the <code>emma</code>
338+
target)</dd>
339+
340+
<dt><code>ant &lt;build_target&gt; install</code></dt>
341+
<dd>Builds and installs a package. Using <code>install</code> by itself fails.</dd>
342+
343+
<dt><code>ant installd</code></dt>
344+
<dd>Installs an already compiled debug package. This fails if the <code>.apk</code> is not
345+
already built.</dd>
346+
347+
<dt><code>ant installr</code></dt>
348+
<dd>Installs an already compiled release package. This fails if the <code>.apk</code> is not
349+
already built.</dd>
350+
351+
<dt><code>ant installt</code></dt>
352+
<dd>Installs an already compiled test package. Also installs the <code>.apk</code> of the
353+
tested application. This fails if the <code>.apk</code> is not already built.</dd>
354+
355+
<dt><code>ant installi</code></dt>
356+
<dd>Installs an already compiled instrumented package. This is generally not used manually as
357+
it's called when installing a test package. This fails if the <code>.apk</code> is not already
358+
built.</dd>
359+
360+
<dt><code>ant test</code></dt>
361+
<dd>Runs the tests (for test projects). The tested and test <code>.apk</code> files must be
362+
previously installed.</dd>
363+
364+
<dt><code>ant debug installt test</code></dt>
365+
<dd>Builds a test project and the tested project, installs both <code>.apk</code> files, and
366+
runs the tests.</dd>
367+
368+
<dt><code>ant emma debug installt test</code></dt>
369+
<dd>Builds a test project and the tested project, installs both <code>.apk</code> files, and
370+
runs the tests with code coverage enabled.</dd>
371+

0 commit comments

Comments
 (0)