blob: 3a44cda109d9be69d690a2c8ae8f8c8219b2fed6 [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
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.
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
128<h2 id="components">Add Android Platforms and Other Components</h2>
129
130<p>Once you've downloaded and installed the SDK, you need to install SDK
131components in it. The SDK starter package includes a tool called Android SDK and
Dirk Doughertyeeb0b252009-10-22 16:08:32 -0700132AVD Manager that helps you see what SDK components are available and then install
133them into your SDK environment. The <a
134href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a> document
135provides step-by-step instructions.</p>
Dirk Doughertyee58d1b2009-10-16 15:25:15 -0700136
137<p>There are several types of SDK components available:</p>
138
139<ul>
140<li><strong>SDK Tools</strong> (available pre-installed in the Android SDK
141package) &mdash; Contains the full set of SDK tools for developing, debugging,
142and testing your application code and UI. You can read about the tools in the <a
143href="{@docRoot}guide/developing/tools/index.html">Dev Guide</a> and access them
144in the <code>&lt;sdk&gt;/tools/</code> directory. </li>
145
146<li><strong>Android platforms</strong> &mdash; An SDK platform component is
147available for every production Android platform deployable to Android-powered
148devices. Each platform component includes a fully compliant Android library and
149system image, sample code, emulator skins, and any version specific tools. For
150detailed information about each platform, see the overview documents available
151under the section "Downloadable SDK Components," at left. </li>
152
153<li><strong>SDK Add-Ons</strong> &mdash; SDK add-ons provide a development
154environment for specific Android external
155library or a customized (but fully compliant) Android system image. The Android
156SDK repository offers the Google APIs Add-On, which gives your application
157access to powerful mapping capabilities through the
158<code>com.google.android.maps</code> library. You can also add additional
159repositories, so that you can download other SDK add-ons, where available. </li>
160
161<li><strong>Documentation</strong> &mdash; Contains a local copy of the latest
162multiversion documentation for the Android framework API.
163</li>
164</ul>
165
Dirk Doughertyeeb0b252009-10-22 16:08:32 -0700166<p>To develop any application, even if you are following the <a
Dirk Doughertyee58d1b2009-10-16 15:25:15 -0700167href="{@docRoot}guide/tutorials/hello-world.html">Hello World</a> tutorial, you
Dirk Doughertyeeb0b252009-10-22 16:08:32 -0700168<strong>must download at least one Android platform</strong> into your SDK.
169Typically, you will want to download multiple platforms, including the version
170that you want to develop against and all other higher platforms. By downloading
171multiple platforms, you can test the forward-compatibility of your application
172by running it on different platforms in the Android emulator. </p>
173
174<p>For more information about adding components and additional repository sites,
175see the <a href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a>.
176</p>
Dirk Doughertyee58d1b2009-10-16 15:25:15 -0700177
178
Dirk Doughertyeeb0b252009-10-22 16:08:32 -0700179<h2 id="sdkContents">Explore the SDK</h2>
Dirk Doughertyee58d1b2009-10-16 15:25:15 -0700180
181<p>Once you've installed the SDK and downloaded the platforms, documentation,
182and add-ons that you need, open the SDK directory and take a look at what's
183inside.</p>
184
Dirk Doughertyeeb0b252009-10-22 16:08:32 -0700185<p>The table below describes the full SDK directory contents, with components
Dirk Doughertyee58d1b2009-10-16 15:25:15 -0700186installed. </p>
187
188<table>
189<tr>
190<th colspan="3">Name</th><th>Description</th>
191</tr>
192<tr>
193<td colspan="3"><code>add-ons/</code></td>
194<td>Contains add-ons to the Android SDK development
195environment, which let you develop against external libraries that are available on some
196devices. </td>
197</tr>
198<tr>
199<td colspan="3"><code>docs/</code></td>
200<td>A full set of documentation in HTML format, including the Developer's Guide,
Dirk Doughertyeeb0b252009-10-22 16:08:32 -0700201API Reference, and other information. To read the documentation, load the
202file <code>offline.html</code> in a web browser.</td>
Dirk Doughertyee58d1b2009-10-16 15:25:15 -0700203</tr>
204<tr>
205<td colspan="3"><code>platforms/</code></td>
206<td>Contains a set of Android platform versions that you can develop
207applications against, each in a separate directory. </td>
208</tr>
209<tr>
210<td style="width:2em;border-bottom-color:white;"></td>
211<td colspan="2"><code>&lt;platform&gt;/</code></td>
212<td>Platform version directory, for example "Android 1.6". All platform version
213directories contain a similar set of files and subdirectory structure.</td>
214</tr>
215
216<tr>
217<td style="width:2em;border-bottom-color:white;">&nbsp;</td>
218<td style="width:2em;border-bottom-color:white;"></td>
219<td><code>data/</code></td>
220<td>Storage area for default fonts and resource definitions.</td>
221</tr>
222<tr>
223<td style="width:2em;border-bottom-color:white;"></td>
224<td style="width:2em;border-bottom-color:white;"></td>
225<td><code>images/</code></td>
226<td>Storage area for default disk images, including the Android system image,
227the default userdata image, the default ramdisk image, and more. The images
228are used in emulator sessions.</td>
229</tr>
230<tr>
231<td style="width:2em;border-bottom-color:white;"></td>
232<td style="width:2em;border-bottom-color:white;"></td>
233<td><code>samples/</code></td>
234<td>Contains a wide variety of sample applications that you can load as projects
235into your development environment, compile, and run on the emulator.</td>
236</tr>
237<tr>
238<td style="width:2em;border-bottom-color:white;"></td>
239<td style="width:2em;border-bottom-color:white;"></td>
240<td><code>skins/</code></td>
241<td>A set of emulator skins available for the platform version. Each skin is
242designed for a specific screen resolution.</td>
243</tr>
244<tr>
245<td style="width:2em;border-bottom-color:white;"></td>
246<td style="width:2em;border-bottom-color:white;"></td>
247<td><code>templates/</code></td>
248<td>Storage area for file templates used by the SDK development tools.</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>tools/</code></td>
254<td>Any development tools that are specific to the platform version.</td>
255</tr>
256<tr>
257<td style="width:2em;"></td>
258<td style="width:2em;"></td>
259<td><code>android.jar</code></td>
260<td>The Android library used when compiling applications against this platform
261version.</td>
262</tr>
263<tr>
264<td colspan="3"><code>tools/</code></td>
265<td>Contains the set of development and profiling tools available to you, such
266as the emulator, the <code>android</code> tool, adb, ddms, and more.</td>
267</tr>
268<tr>
Dirk Doughertyeeb0b252009-10-22 16:08:32 -0700269<td colspan="3"><code>SDK Readme.txt</code></td>
270<td>A file that explains how to perform the initial setup of your SDK,
271including how to launch the Android SDK and AVD Manager tool on all
272platforms</td>
Dirk Doughertyee58d1b2009-10-16 15:25:15 -0700273</tr>
274<tr>
Dirk Doughertyeeb0b252009-10-22 16:08:32 -0700275<td colspan="3"><code>SDK Setup.exe</code></td>
276<td>For Windows SDK only. A shortcut that launches the Android SDK and AVD
277Manager tool, which you use to add components to your SDK. </td>
278</tr>
279<!--<tr>
Dirk Doughertyee58d1b2009-10-16 15:25:15 -0700280<td colspan="3"><code>documentation.html</code></td>
281<td>A file that loads the entry page for the local Android SDK
282documentation.</td>
Dirk Doughertyeeb0b252009-10-22 16:08:32 -0700283</tr>-->
Dirk Doughertyee58d1b2009-10-16 15:25:15 -0700284
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>