blob: e4fbfa0e84084e6677103134078d6886d64a621c [file] [log] [blame]
Dirk Doughertyee58d1b2009-10-16 15:25:15 -07001page.title=Installing the Android SDK
2sdk.preview=0
3
4@jd:body
5
6<div id="qv-wrapper">
7<div id="qv">
8
9 <h2>In this document</h2>
10 <ol>
11 <li><a href="#Preparing">Prepare for Installation</a></li>
12 <li><a href="#Installing">Install the SDK</a></li>
13 <li><a href="#InstallingADT">Install the ADT Plugin for Eclipse</a></li>
14 <li><a href="#components">Add Platforms and Other SDK Components</a></li>
15 <li><a href="#sdkContents">SDK Contents</a></li>
16 <li><a href="#NextSteps">Next Steps</a></li>
17 <li><a href="#troubleshooting">Troubleshooting</a></li>
18 </ol>
19
20<h2>See also</h2>
21 <ol>
22 <li><a href="{@docRoot}sdk/eclipse-adt.html">Installing ADT</a></li>
23 <li><a href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a></li>
24 </ol>
25
26</div>
27</div>
28
29<p>This page describes how to install the Android SDK and set up your
30development environment for the first time.</p>
31
32<p>If you encounter any problems during installation, see the
33<a href="#InstallationNotes">Installation Notes</a> at the bottom of
34this page.</p>
35
36<h4>Updating?</h4>
37
38<p>If you are currently using the Android 1.6 SDK, you do not necessarily need
39to install the new SDK, since your existing SDK incudes the Android SDK and AVD
40Manager tool. To develop against the new Android 2.0 platform, for example, you
41could just download the updated SDK Tools (Revision 3) and the Android 2.0
42platform into your existing SDK.</p>
43
44<p>If you are using Android 1.5 SDK or older, you should install the new SDK as
45described in this document and move your application projects to the new
46environment. </p>
47
48<h2 id="Preparing">Prepare for Installation</h2>
49
50<p>Before you begin, take a moment to confirm that your development machine
51meets the <a href="requirements.html">System Requirements</a>.</p>
52
53<p>If you will be developing in Eclipse with the Android Development
54Tools (ADT) Plugin &mdash; the recommended path if you are new to
55Android &mdash; make sure that you have a suitable version of Eclipse
56installed on your computer (3.4 or newer is recommended). If you need
57to install Eclipse, you can download it from this location: </p>
58
59<p style="margin-left:2em;"><a href=
60"http://www.eclipse.org/downloads/">http://www.eclipse.org/downloads/</a></p>
61
62<p>A Java or RCP version of Eclipse is recommended. For Eclipse 3.5, the
63"Eclipse Classic" version is recommended.</p>
64
65<h2 id="Installing">Download and Install the SDK</h2>
66
67<p>Download the SDK package that is appropriate for your development computer.
68Unpack the Android SDK .zip archive to a suitable location on your machine. By
69default, the SDK files are unpacked into a directory named
70<code>android_sdk</code>. </p>
71
72<p>Make a note of the name and location of the unpacked SDK directory on your
73system &mdash; you will need to refer to the SDK directory later, when setting
74up the ADT plugin or when using the SDK tools.</p>
75
76<p>Optionally, you may want to add the location of the SDK's primary
77<code>tools</code> directory to your system <code>PATH</code>. The primary
78<code>tools/</code> directory is located at the root of the SDK folder. Adding
79<code>tools</code> to your path lets you run Android Debug Bridge (adb) and the
80other command line <a
81href="{@docRoot}guide/developing/tools/index.html">tools</a> without needing to
82supply the full path to the tools directory. </p>
83
84<ul>
85 <li>On Linux, edit your <code>~/.bash_profile</code> or <code>~/.bashrc</code> file. Look
86 for a line that sets the PATH environment variable and add the
87 full path to the <code>tools/</code> directory to it. If you don't
88 see a line setting the path, you can add one:</li>
89
90 <ul><code>export PATH=${PATH}:<em>&lt;your_sdk_dir&gt;</em>/tools</code></ul>
91
92 <li>On a Mac OS X, look in your home directory for <code>.bash_profile</code> and
93 proceed as for Linux. You can create the <code>.bash_profile</code> if
94 you haven't already set one up on your machine. </li>
95
96 <li>On Windows, right-click on My Computer, and select Properties.
97 Under the Advanced tab, hit the Environment Variables button, and in the
98 dialog that comes up, double-click on Path (under System Variables). Add the full path to the
99 <code>tools/</code> directory to the path. </li>
100 </ul>
101
102<p>Note that, if you update your SDK in the future, you
103should remember to update your <code>PATH</code> settings to point to the new location, if different.</p>
104
105<p>If you will be using the Eclipse IDE as your development environment,
106the next section describes how to install the Android Development Tools (ADT) plugin and set up Eclipse.
107If you choose not to use Eclipse, you can
108develop Android applications in an IDE of your choice and then compile, debug and deploy using
109the tools included in the SDK (skip to <a href="#NextSteps">Next Steps</a>).</p>
110
111
112<h2 id="InstallingADT">Install the ADT Plugin for Eclipse</h2>
113
114<p>Android offers a custom plugin for the Eclipse IDE, called Android
115Development Tools (ADT), that is designed to give you a powerful,
116integrated environment in which to build Android applications. It
117extends the capabilites of Eclipse to let you quickly set up new Android
118projects, create an application UI, add components based on the Android
119Framework API, debug your applications using the Android SDK tools, and even export
120signed (or unsigned) APKs in order to distribute your application.</p>
121
122<p>In general, using Eclipse with ADT is a highly recommended approach to
123Android development and is the fastest way to get started. For complete
124information about how to install ADT, see
125<a href="{@docRoot}sdk/eclipse-adt.html">Installing and Updating ADT</a>.</p>
126
127<p>If you prefer to work in an IDE other than Eclipse, you do not need to
128install Eclipse or ADT, instead, you can directly use the SDK tools to build and
129debug your application &mdash; skip to <a href="#NextSteps">Next Steps</a>.)</p>
130
131<h2 id="components">Add Android Platforms and Other Components</h2>
132
133<p>Once you've downloaded and installed the SDK, you need to install SDK
134components in it. The SDK starter package includes a tool called Android SDK and
135AVD Manager to help you see what components are available and then install them
136into your SDK environment.</p>
137
138<p>There are several types of SDK components available:</p>
139
140<ul>
141<li><strong>SDK Tools</strong> (available pre-installed in the Android SDK
142package) &mdash; Contains the full set of SDK tools for developing, debugging,
143and testing your application code and UI. You can read about the tools in the <a
144href="{@docRoot}guide/developing/tools/index.html">Dev Guide</a> and access them
145in the <code>&lt;sdk&gt;/tools/</code> directory. </li>
146
147<li><strong>Android platforms</strong> &mdash; An SDK platform component is
148available for every production Android platform deployable to Android-powered
149devices. Each platform component includes a fully compliant Android library and
150system image, sample code, emulator skins, and any version specific tools. For
151detailed information about each platform, see the overview documents available
152under the section "Downloadable SDK Components," at left. </li>
153
154<li><strong>SDK Add-Ons</strong> &mdash; SDK add-ons provide a development
155environment for specific Android external
156library or a customized (but fully compliant) Android system image. The Android
157SDK repository offers the Google APIs Add-On, which gives your application
158access to powerful mapping capabilities through the
159<code>com.google.android.maps</code> library. You can also add additional
160repositories, so that you can download other SDK add-ons, where available. </li>
161
162<li><strong>Documentation</strong> &mdash; Contains a local copy of the latest
163multiversion documentation for the Android framework API.
164</li>
165</ul>
166
167<p>For information about how to use the Android SDK and AVD Manager to download
168any of these components into your SDK, see the instructions in </p>
169<p style="margin-left:2em;"><a
170href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a>. </p>
171
172<p>To develop an application, you <strong>must download at least one Android
173platform</strong> into your SDK. Typically, you will want to download multiple
174platforms, including the version that you want to develop against and all other
175higher platforms. By downloading multiple platforms, you can test the
176forward-compatibility of your application by running it on different platforms
177in the Android emulator. </p>
178
179<p class="note"><strong>Note:</strong> To get started with any application, even
180if you are following the <a
181href="{@docRoot}guide/tutorials/hello-world.html">Hello World</a> tutorial, you
182must download at least one Android platform into your SDK. For instructions, see
183<a href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a></p>
184
185
186<h2 id="sdkContents">Contents of the SDK</h2>
187
188<p>Once you've installed the SDK and downloaded the platforms, documentation,
189and add-ons that you need, open the SDK directory and take a look at what's
190inside.</p>
191
192<p>The table below describes the full SDK directory contents, with all components
193installed. </p>
194
195<table>
196<tr>
197<th colspan="3">Name</th><th>Description</th>
198</tr>
199<tr>
200<td colspan="3"><code>add-ons/</code></td>
201<td>Contains add-ons to the Android SDK development
202environment, which let you develop against external libraries that are available on some
203devices. </td>
204</tr>
205<tr>
206<td colspan="3"><code>docs/</code></td>
207<td>A full set of documentation in HTML format, including the Developer's Guide,
208API Reference, and other information.</td>
209</tr>
210<tr>
211<td colspan="3"><code>platforms/</code></td>
212<td>Contains a set of Android platform versions that you can develop
213applications against, each in a separate directory. </td>
214</tr>
215<tr>
216<td style="width:2em;border-bottom-color:white;"></td>
217<td colspan="2"><code>&lt;platform&gt;/</code></td>
218<td>Platform version directory, for example "Android 1.6". All platform version
219directories contain a similar set of files and subdirectory structure.</td>
220</tr>
221
222<tr>
223<td style="width:2em;border-bottom-color:white;">&nbsp;</td>
224<td style="width:2em;border-bottom-color:white;"></td>
225<td><code>data/</code></td>
226<td>Storage area for default fonts and resource definitions.</td>
227</tr>
228<tr>
229<td style="width:2em;border-bottom-color:white;"></td>
230<td style="width:2em;border-bottom-color:white;"></td>
231<td><code>images/</code></td>
232<td>Storage area for default disk images, including the Android system image,
233the default userdata image, the default ramdisk image, and more. The images
234are used in emulator sessions.</td>
235</tr>
236<tr>
237<td style="width:2em;border-bottom-color:white;"></td>
238<td style="width:2em;border-bottom-color:white;"></td>
239<td><code>samples/</code></td>
240<td>Contains a wide variety of sample applications that you can load as projects
241into your development environment, compile, and run on the emulator.</td>
242</tr>
243<tr>
244<td style="width:2em;border-bottom-color:white;"></td>
245<td style="width:2em;border-bottom-color:white;"></td>
246<td><code>skins/</code></td>
247<td>A set of emulator skins available for the platform version. Each skin is
248designed for a specific screen resolution.</td>
249</tr>
250<tr>
251<td style="width:2em;border-bottom-color:white;"></td>
252<td style="width:2em;border-bottom-color:white;"></td>
253<td><code>templates/</code></td>
254<td>Storage area for file templates used by the SDK development tools.</td>
255</tr>
256<tr>
257<td style="width:2em;border-bottom-color:white;"></td>
258<td style="width:2em;border-bottom-color:white;"></td>
259<td><code>tools/</code></td>
260<td>Any development tools that are specific to the platform version.</td>
261</tr>
262<tr>
263<td style="width:2em;"></td>
264<td style="width:2em;"></td>
265<td><code>android.jar</code></td>
266<td>The Android library used when compiling applications against this platform
267version.</td>
268</tr>
269<tr>
270<td colspan="3"><code>tools/</code></td>
271<td>Contains the set of development and profiling tools available to you, such
272as the emulator, the <code>android</code> tool, adb, ddms, and more.</td>
273</tr>
274<tr>
275<td colspan="3"><code>RELEASE_NOTES.html</code></td>
276<td>A file that loads the local version of the SDK release notes, if
277available.</td>
278</tr>
279<tr>
280<td colspan="3"><code>documentation.html</code></td>
281<td>A file that loads the entry page for the local Android SDK
282documentation.</td>
283</tr>
284
285</table>
286
287<h2 id="NextSteps">Next Steps</h2>
288<p>Once you have completed installation, you are ready to
289begin developing applications. Here are a few ways you can get started: </p>
290
291<p><strong>Learn about Android</strong></p>
292<ul>
293 <li>Take a look at the <a href="{@docRoot}guide/index.html">Dev
294 Guide</a> and the types of information it provides</li>
295 <li>Read an introduction to Android as a platform in <a
296 href="{@docRoot}guide/basics/what-is-android.html">What is
297 Android?</a></li>
298 <li>Learn about the Android framework and how applications run on it in
299 <a href="{@docRoot}guide/topics/fundamentals.html">Application
300 Fundamentals</a></li>
301 <li>Take a look at the Android framework API specification in the <a
302 href="{@docRoot}reference/packages.html">Reference</a> tab</li>
303</ul>
304
305<p><strong>Explore the SDK</strong></p>
306<ul>
307 <li>Get an overview of the <a
308 href="{@docRoot}guide/developing/tools/index.html">development
309 tools</a> that are available to you</li>
310 <li>Read how to develop <a
311 href="{@docRoot}guide/developing/eclipse-adt.html">in Eclipse/ADT</a> or
312 <a href="{@docRoot}guide/developing/other-ide.html">in other IDEs</a>
313 </li>
314</ul>
315
316<p><strong>Explore some code</strong></p>
317<ul>
318 <li>Set up a <a href="{@docRoot}guide/tutorials/hello-world.html">Hello
319 World application</a> (highly recommended, especially for Eclipse users)</li>
320 <li>Follow the <a href="{@docRoot}guide/tutorials/notepad/index.html">
321 Notepad Tutorial</a> to build a full Android application </li>
322 <li>Create a new project for one of the other sample applications
323 included in <code><em>&lt;sdk&gt;</em>/platforms/<em>&lt;platform&gt;</em>/samples</code>,
324 then compile and run it in your development environment</li>
325</ul>
326
327<p><strong>Visit the Android developer groups</strong></p>
328<ul>
329 <li>Take a look at the <a
330 href="{@docRoot}community/index.html">Community</a> tab to see a list of
331 Android developers groups. In particular, you might want to look at the
332 <a href="http://groups.google.com/group/android-developers">Android
333 Developers</a> group to get a sense for what the Android developer
334 community is like.</li>
335</ul>
336
337
338<h2 id="troubleshooting">Installation Troubleshooting</h2>
339
340<h3>Ubuntu Linux Notes</h3>
341
342<ul>
343 <li>If you need help installing and configuring Java on your
344 development machine, you might find these resources helpful:
345 <ul>
346 <li><a href="https://help.ubuntu.com/community/Java">https://help.ubuntu.com/community/Java </a></li>
347 <li><a href="https://help.ubuntu.com/community/Java">https://help.ubuntu.com/community/JavaInstallation</a></li>
348 </ul>
349 </li>
350 <li>Here are the steps to install Java and Eclipse, prior to installing
351 the Android SDK and ADT Plugin.
352 <ol>
353 <li>If you are running a 64-bit distribution on your development
354 machine, you need to install the <code>ia32-libs</code> package using
355 <code>apt-get:</code>:
356 <pre>apt-get install ia32-libs</pre>
357 </li>
358 <li>Next, install Java: <pre>apt-get install sun-java6-bin</pre></li>
359 <li>The Ubuntu package manager does not currently offer an Eclipse 3.3
360 version for download, so we recommend that you download Eclipse from
361 eclipse.org (<a
362 href="http://www.eclipse.org/downloads/">http://www.eclipse.org/
363 downloads/</a>). A Java or RCP version of Eclipse is recommended.</li>
364 <li>Follow the steps given in previous sections to install the SDK
365 and the ADT plugin. </li>
366 </ol>
367 </li>
368</ul>
369
370<h3>Other Linux Notes</h3>
371
372<ul>
373 <li>If JDK is already installed on your development computer, please
374 take a moment to make sure that it meets the version requirements listed
375 in the <a href="requirements.html">System Requirements</a>.
376 In particular, note that some Linux distributions may include JDK 1.4 or Gnu
377 Compiler for Java, both of which are not supported for Android development.</li>
378</ul>