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