summaryrefslogtreecommitdiffstats
path: root/docs/html/guide/developing/othertools.jd
blob: 4ebcf4a857dc45e729ab0406b04c16cd425d48c3 (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
page.title=Other Tools
@jd:body

<p>The sections below describe other tools that you can use when building Android applications. </p>

<p>All of the tools are included in the Android SDK and are accessible from the <code>tools/</code> directory.</p>

<h2>Contents</h2>

<dl>
    <dt><a href="#mksdcard">mksdcard</a></dt>
    <dt><a href="#dx">dx</a></dt>
    <dt><a href="#activitycreator">activitycreator</a></dd>
</dl>

<a name="mksdcard"></a>

<h2>mksdcard</h2>

<p>The mksdcard tool lets you quickly create a FAT32 disk image that you can load in the emulator, to simulate the presence of an SD card in the device. Here is the usage for mksdcard:</p>

<pre>mksdcard [-l label] &lt;size&gt;[K|M] &lt;file&gt;</pre>

</p>The table below lists the available options/arguments</p>

<table>
<tr>
	<th>Argument</th>
	<th>Description</th>
</tr>

<tr>
	<td><code>-l</code></td>
	<td>A volume label for the disk image to create. </td>
</tr>

<tr>
	<td><code>size</code></td>
	<td>An integer that specifies the size (in bytes) of disk image to create. 
You can also specify size in kilobytes or megabytes, by appending a "K" or "M" to &lt;size&gt;. For example, <code>1048576K</code>, <code>1024M</code>.</td>
</tr>

<tr>
	<td><code>file</code></td>
	<td>The path/filename of the disk image to create. </td>
</tr>

</table>

<p>Once you have created the disk image file, you can load it in the emulator at startup using the emulator's -sdcard option. For more information, see <a href="{@docRoot}reference/emulator.html">Android Emulator</a>.</p>

<pre>emulator -sdcard &lt;file&gt;</pre>

<a name="dx"></a>

<h2>dx</h2>

<p>The dx tool lets you generate Android bytecode from .class files. The tool converts target files and/or directories to Dalvik executable format (.dex) files, so that they can run in the Android environment. It can also dump the class files in a human-readable format and run a target unit test. You can get the usage and options for this tool by using <code>dx -help</code>.</p>

<a name="activitycreator"></a>

<h2>activitycreator</h2>

<p>If you aren't using the Eclipse IDE and ADT plugin, you can use the the activitycreator script to get started with a new application. When you run the script, it creates the structure of a minimal Android application that you can build on and extend to meet your needs. </p>

<p>For Linux and Mac, the SDK provides <code>activitycreator.py</code>, a Python script, and for Windows <code>activitycreator.bat</code>, a batch script that runs an executable. Regardless of platform, the usage for the script is the same:</p>

<pre>activitycreator [--out &lt;folder&gt;] [--ide intellij] your.package.name.ActivityName</pre>

<table>
<tr>
	<th>Option</th>
	<th>Description</th>
</tr>

<tr>
	<td><code>--out &lt;folder&gt;</code></td>
	<td>Specifies where to create the files/folders. </td>
</tr>

<tr>
	<td><code>--ide intellij</code></td>
	<td>Creates project files for IntelliJ</td>
</tr>

</table>


<p>When run, the script creates these files: </p>

 <ul>
	<li>AndroidManifest.xml -- The application manifest file.</li>
	<li>build.xml -- An Ant script to build/package the application.</li>
	<li>res -- The resource directory.</li>
	<li>src -- The source directory.</li>
	<li>src/your/package/name/ActivityName.java -- The Activity class. </li>
	<li>bin -- The output folder for the compiled .apk (when built by Ant).</li>
</ul>

<p>When you are ready, you can use Ant to <a href="{@docRoot}intro/installing.html#buildingwithant">build the project</a> so that you can run it on the emulator.</p>

<p>If you are using Eclipse with the ADT plugin, you do not need to use activitycreator. You can use the New Project Wizard, provided by the ADT plugin, instead. </p>