blob: edc77e83855f2d9968afee627cdae2387844a8dc [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>
Dirk Doughertyeeb0b252009-10-22 16:08:32 -070015 <li><a href="#sdkContents">Explore the SDK</a></li>
Dirk Doughertyee58d1b2009-10-16 15:25:15 -070016 <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
Dirk Doughertya250f0c2009-10-22 18:02:45 -070033<a href="#troubleshooting">Troubleshooting</a> section at the bottom of
Dirk Doughertyee58d1b2009-10-16 15:25:15 -070034this 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
Dirk Doughertybf15ce62009-10-23 19:17:12 -070039to install the new SDK, since your existing SDK already includes the Android SDK
40and AVD Manager tool. To develop against the new Android 2.0 platform, for
41example, you could just download the updated SDK Tools (Revision 3) and the
42Android 2.0 platform into your existing SDK.</p>
Dirk Doughertyee58d1b2009-10-16 15:25:15 -070043
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.
Dirk Doughertyeeb0b252009-10-22 16:08:32 -070068Unpack the Android SDK archive to a suitable location on your machine. By
Dirk Doughertyee58d1b2009-10-16 15:25:15 -070069default, the SDK files are unpacked into a directory named
Dirk Doughertyeeb0b252009-10-22 16:08:32 -070070<code>android-sdk-&lt;machine-platform&gt;</code>. </p>
Dirk Doughertyee58d1b2009-10-16 15:25:15 -070071
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
Dirk Doughertyee58d1b2009-10-16 15:25:15 -0700102<p>If you will be using the Eclipse IDE as your development environment,
103the next section describes how to install the Android Development Tools (ADT) plugin and set up Eclipse.
104If you choose not to use Eclipse, you can
105develop Android applications in an IDE of your choice and then compile, debug and deploy using
106the tools included in the SDK (skip to <a href="#NextSteps">Next Steps</a>).</p>
107
108
109<h2 id="InstallingADT">Install the ADT Plugin for Eclipse</h2>
110
111<p>Android offers a custom plugin for the Eclipse IDE, called Android
112Development Tools (ADT), that is designed to give you a powerful,
113integrated environment in which to build Android applications. It
114extends the capabilites of Eclipse to let you quickly set up new Android
115projects, create an application UI, add components based on the Android
116Framework API, debug your applications using the Android SDK tools, and even export
117signed (or unsigned) APKs in order to distribute your application.</p>
118
119<p>In general, using Eclipse with ADT is a highly recommended approach to
120Android development and is the fastest way to get started. For complete
121information about how to install ADT, see
122<a href="{@docRoot}sdk/eclipse-adt.html">Installing and Updating ADT</a>.</p>
123
124<p>If you prefer to work in an IDE other than Eclipse, you do not need to
125install Eclipse or ADT, instead, you can directly use the SDK tools to build and
Dirk Doughertyeeb0b252009-10-22 16:08:32 -0700126debug your application.</p>
Dirk Doughertyee58d1b2009-10-16 15:25:15 -0700127
Dirk Doughertybf15ce62009-10-23 19:17:12 -0700128
Dirk Doughertyee58d1b2009-10-16 15:25:15 -0700129<h2 id="components">Add Android Platforms and Other Components</h2>
130
Dirk Doughertybf15ce62009-10-23 19:17:12 -0700131<div class="sidebox-wrapper">
132<div class="sidebox">
133<p>The <strong>Android SDK and AVD Manager</strong> tool is pre-installed in
134your SDK. Using the tool is a key part of performing the initial setup of your
135SDK, as well as keeping it up-to-date with the latest platforms, tools, and
136other components. </p>
137
138<p style="margin-top:.75em;">For full instructions on how to use the tool, see
139<a href="/sdk/adding-components.html#installingComponents">Adding SDK
140Components</a>.</p>
141</div>
142</div>
143
144<p>The Android SDK uses a modular structure that separates the major parts of
145the SDK &mdash; platforms, add-ons, tools, and the API documentation &mdash;
146into a set of separately installable components. The SDK components are
147available to you for individual download, as needed, from the Android SDK
148repository site. </p>
149
150<p>The Android SDK starter package includes only a single component: the latest
151version of the SDK Tools. Included in that component is a tool called <em>Android
152SDK and AVD Manager</em> that you can use to download other components from the SDK
153repository site. The tool provides a graphical UI that lets you browse the
154repository, select new or updated components for download, and then install them
155in your SDK. </p>
Dirk Doughertyee58d1b2009-10-16 15:25:15 -0700156
157<p>There are several types of SDK components available:</p>
158
159<ul>
160<li><strong>SDK Tools</strong> (available pre-installed in the Android SDK
161package) &mdash; Contains the full set of SDK tools for developing, debugging,
162and testing your application code and UI. You can read about the tools in the <a
163href="{@docRoot}guide/developing/tools/index.html">Dev Guide</a> and access them
164in the <code>&lt;sdk&gt;/tools/</code> directory. </li>
165
166<li><strong>Android platforms</strong> &mdash; An SDK platform component is
167available for every production Android platform deployable to Android-powered
168devices. Each platform component includes a fully compliant Android library and
169system image, sample code, emulator skins, and any version specific tools. For
170detailed information about each platform, see the overview documents available
171under the section "Downloadable SDK Components," at left. </li>
172
173<li><strong>SDK Add-Ons</strong> &mdash; SDK add-ons provide a development
174environment for specific Android external
175library or a customized (but fully compliant) Android system image. The Android
176SDK repository offers the Google APIs Add-On, which gives your application
177access to powerful mapping capabilities through the
178<code>com.google.android.maps</code> library. You can also add additional
179repositories, so that you can download other SDK add-ons, where available. </li>
180
181<li><strong>Documentation</strong> &mdash; Contains a local copy of the latest
182multiversion documentation for the Android framework API.
183</li>
184</ul>
185
Dirk Doughertybf15ce62009-10-23 19:17:12 -0700186<p>To develop <em>any</em> Android application, even if you are following the <a
Dirk Doughertyee58d1b2009-10-16 15:25:15 -0700187href="{@docRoot}guide/tutorials/hello-world.html">Hello World</a> tutorial, you
Dirk Doughertyeeb0b252009-10-22 16:08:32 -0700188<strong>must download at least one Android platform</strong> into your SDK.
Dirk Doughertybf15ce62009-10-23 19:17:12 -0700189Typically, you will want to download multiple platforms, so that you can build
190your application on the lowest version you want to support, but test against
191higher versions that you intend the application to run on. You can test your
192applications on different platforms by running in an
193Android Virtual Device (AVD) on the Android emulator. </p>
Dirk Doughertyeeb0b252009-10-22 16:08:32 -0700194
Dirk Doughertybf15ce62009-10-23 19:17:12 -0700195<p>For step-by-step instructions on how to use the Android SDK and AVD Manager
196to add components, see the <a href="{@docRoot}sdk/adding-components.html">Adding
197SDK Components</a> document. </p>
198
199<p>For release notes and other detailed information about individual SDK
200components, see the documents listed under "Downloadable SDK Components" in
201the navigation at left.</p>
Dirk Doughertyee58d1b2009-10-16 15:25:15 -0700202
203
Dirk Doughertyeeb0b252009-10-22 16:08:32 -0700204<h2 id="sdkContents">Explore the SDK</h2>
Dirk Doughertyee58d1b2009-10-16 15:25:15 -0700205
206<p>Once you've installed the SDK and downloaded the platforms, documentation,
207and add-ons that you need, open the SDK directory and take a look at what's
208inside.</p>
209
Dirk Doughertyeeb0b252009-10-22 16:08:32 -0700210<p>The table below describes the full SDK directory contents, with components
Dirk Doughertyee58d1b2009-10-16 15:25:15 -0700211installed. </p>
212
213<table>
214<tr>
215<th colspan="3">Name</th><th>Description</th>
216</tr>
217<tr>
218<td colspan="3"><code>add-ons/</code></td>
219<td>Contains add-ons to the Android SDK development
220environment, which let you develop against external libraries that are available on some
221devices. </td>
222</tr>
223<tr>
224<td colspan="3"><code>docs/</code></td>
225<td>A full set of documentation in HTML format, including the Developer's Guide,
Dirk Doughertyeeb0b252009-10-22 16:08:32 -0700226API Reference, and other information. To read the documentation, load the
227file <code>offline.html</code> in a web browser.</td>
Dirk Doughertyee58d1b2009-10-16 15:25:15 -0700228</tr>
229<tr>
230<td colspan="3"><code>platforms/</code></td>
231<td>Contains a set of Android platform versions that you can develop
232applications against, each in a separate directory. </td>
233</tr>
234<tr>
235<td style="width:2em;border-bottom-color:white;"></td>
236<td colspan="2"><code>&lt;platform&gt;/</code></td>
237<td>Platform version directory, for example "Android 1.6". All platform version
238directories contain a similar set of files and subdirectory structure.</td>
239</tr>
240
241<tr>
242<td style="width:2em;border-bottom-color:white;">&nbsp;</td>
243<td style="width:2em;border-bottom-color:white;"></td>
244<td><code>data/</code></td>
245<td>Storage area for default fonts and resource definitions.</td>
246</tr>
247<tr>
248<td style="width:2em;border-bottom-color:white;"></td>
249<td style="width:2em;border-bottom-color:white;"></td>
250<td><code>images/</code></td>
251<td>Storage area for default disk images, including the Android system image,
252the default userdata image, the default ramdisk image, and more. The images
253are used in emulator sessions.</td>
254</tr>
255<tr>
256<td style="width:2em;border-bottom-color:white;"></td>
257<td style="width:2em;border-bottom-color:white;"></td>
258<td><code>samples/</code></td>
259<td>Contains a wide variety of sample applications that you can load as projects
260into your development environment, compile, and run on the emulator.</td>
261</tr>
262<tr>
263<td style="width:2em;border-bottom-color:white;"></td>
264<td style="width:2em;border-bottom-color:white;"></td>
265<td><code>skins/</code></td>
266<td>A set of emulator skins available for the platform version. Each skin is
267designed for a specific screen resolution.</td>
268</tr>
269<tr>
270<td style="width:2em;border-bottom-color:white;"></td>
271<td style="width:2em;border-bottom-color:white;"></td>
272<td><code>templates/</code></td>
273<td>Storage area for file templates used by the SDK development tools.</td>
274</tr>
275<tr>
276<td style="width:2em;border-bottom-color:white;"></td>
277<td style="width:2em;border-bottom-color:white;"></td>
278<td><code>tools/</code></td>
279<td>Any development tools that are specific to the platform version.</td>
280</tr>
281<tr>
282<td style="width:2em;"></td>
283<td style="width:2em;"></td>
284<td><code>android.jar</code></td>
285<td>The Android library used when compiling applications against this platform
286version.</td>
287</tr>
288<tr>
289<td colspan="3"><code>tools/</code></td>
290<td>Contains the set of development and profiling tools available to you, such
291as the emulator, the <code>android</code> tool, adb, ddms, and more.</td>
292</tr>
293<tr>
Dirk Doughertyeeb0b252009-10-22 16:08:32 -0700294<td colspan="3"><code>SDK Readme.txt</code></td>
295<td>A file that explains how to perform the initial setup of your SDK,
296including how to launch the Android SDK and AVD Manager tool on all
297platforms</td>
Dirk Doughertyee58d1b2009-10-16 15:25:15 -0700298</tr>
299<tr>
Dirk Doughertyeeb0b252009-10-22 16:08:32 -0700300<td colspan="3"><code>SDK Setup.exe</code></td>
301<td>For Windows SDK only. A shortcut that launches the Android SDK and AVD
302Manager tool, which you use to add components to your SDK. </td>
303</tr>
304<!--<tr>
Dirk Doughertyee58d1b2009-10-16 15:25:15 -0700305<td colspan="3"><code>documentation.html</code></td>
306<td>A file that loads the entry page for the local Android SDK
307documentation.</td>
Dirk Doughertyeeb0b252009-10-22 16:08:32 -0700308</tr>-->
Dirk Doughertyee58d1b2009-10-16 15:25:15 -0700309
310</table>
311
312<h2 id="NextSteps">Next Steps</h2>
313<p>Once you have completed installation, you are ready to
314begin developing applications. Here are a few ways you can get started: </p>
315
316<p><strong>Learn about Android</strong></p>
317<ul>
318 <li>Take a look at the <a href="{@docRoot}guide/index.html">Dev
319 Guide</a> and the types of information it provides</li>
320 <li>Read an introduction to Android as a platform in <a
321 href="{@docRoot}guide/basics/what-is-android.html">What is
322 Android?</a></li>
323 <li>Learn about the Android framework and how applications run on it in
324 <a href="{@docRoot}guide/topics/fundamentals.html">Application
325 Fundamentals</a></li>
326 <li>Take a look at the Android framework API specification in the <a
327 href="{@docRoot}reference/packages.html">Reference</a> tab</li>
328</ul>
329
330<p><strong>Explore the SDK</strong></p>
331<ul>
332 <li>Get an overview of the <a
333 href="{@docRoot}guide/developing/tools/index.html">development
334 tools</a> that are available to you</li>
335 <li>Read how to develop <a
336 href="{@docRoot}guide/developing/eclipse-adt.html">in Eclipse/ADT</a> or
337 <a href="{@docRoot}guide/developing/other-ide.html">in other IDEs</a>
338 </li>
339</ul>
340
341<p><strong>Explore some code</strong></p>
342<ul>
343 <li>Set up a <a href="{@docRoot}guide/tutorials/hello-world.html">Hello
344 World application</a> (highly recommended, especially for Eclipse users)</li>
345 <li>Follow the <a href="{@docRoot}guide/tutorials/notepad/index.html">
346 Notepad Tutorial</a> to build a full Android application </li>
347 <li>Create a new project for one of the other sample applications
348 included in <code><em>&lt;sdk&gt;</em>/platforms/<em>&lt;platform&gt;</em>/samples</code>,
349 then compile and run it in your development environment</li>
350</ul>
351
352<p><strong>Visit the Android developer groups</strong></p>
353<ul>
354 <li>Take a look at the <a
355 href="{@docRoot}community/index.html">Community</a> tab to see a list of
356 Android developers groups. In particular, you might want to look at the
357 <a href="http://groups.google.com/group/android-developers">Android
358 Developers</a> group to get a sense for what the Android developer
359 community is like.</li>
360</ul>
361
362
Dirk Dougherty6b13bc02009-10-30 19:05:53 -0700363<h2 id="troubleshooting">Troubleshooting</h2>
Dirk Doughertyee58d1b2009-10-16 15:25:15 -0700364
365<h3>Ubuntu Linux Notes</h3>
366
367<ul>
368 <li>If you need help installing and configuring Java on your
369 development machine, you might find these resources helpful:
370 <ul>
371 <li><a href="https://help.ubuntu.com/community/Java">https://help.ubuntu.com/community/Java </a></li>
372 <li><a href="https://help.ubuntu.com/community/Java">https://help.ubuntu.com/community/JavaInstallation</a></li>
373 </ul>
374 </li>
375 <li>Here are the steps to install Java and Eclipse, prior to installing
376 the Android SDK and ADT Plugin.
377 <ol>
378 <li>If you are running a 64-bit distribution on your development
379 machine, you need to install the <code>ia32-libs</code> package using
380 <code>apt-get:</code>:
381 <pre>apt-get install ia32-libs</pre>
382 </li>
383 <li>Next, install Java: <pre>apt-get install sun-java6-bin</pre></li>
384 <li>The Ubuntu package manager does not currently offer an Eclipse 3.3
385 version for download, so we recommend that you download Eclipse from
386 eclipse.org (<a
387 href="http://www.eclipse.org/downloads/">http://www.eclipse.org/
388 downloads/</a>). A Java or RCP version of Eclipse is recommended.</li>
389 <li>Follow the steps given in previous sections to install the SDK
390 and the ADT plugin. </li>
391 </ol>
392 </li>
393</ul>
394
395<h3>Other Linux Notes</h3>
396
397<ul>
398 <li>If JDK is already installed on your development computer, please
399 take a moment to make sure that it meets the version requirements listed
400 in the <a href="requirements.html">System Requirements</a>.
401 In particular, note that some Linux distributions may include JDK 1.4 or Gnu
402 Compiler for Java, both of which are not supported for Android development.</li>
403</ul>