installing.jd revision 843ef36f7b96cc19ea7d2996b7c8661b41ec3452
1sdk.version=1.5
2sdk.rel.id=1
3sdk.date=April 2009
4
5page.title=Installing the Android SDK
6@jd:body
7
8
9<p>This page describes how to install the Android SDK and set up your
10development environment. If you haven't downloaded the SDK, you can
11do so from the 
12<a href="{@docRoot}sdk/1.5_r1/index.html">Download</a> page. Once you've downloaded
13the SDK, return here.</p>
14
15<p>If you encounter any problems during installation, see the 
16<a href="#installnotes">Installation Notes</a> at the bottom of
17this page.</p>
18
19<h4 style="margin-top">Upgrading?</h4>
20<p>If you have already developed applications using an earlier version
21of the SDK, please read 
22<a href="{@docRoot}sdk/1.5_r1/upgrading.html"><strong>Upgrading the
23SDK</strong></a></b>, instead.
24</p>
25
26
27<h2 id="setup">Preparing for Installation</h2>
28
29<p>Before you begin, take a moment to confirm that your development machine meets the 
30<a href="{@docRoot}sdk/1.5_r1/requirements.html">System Requirements</a>.
31</p>
32
33<p>If you will be developing on Eclipse with the Android Development
34Tools (ADT) Plugin &mdash; the recommended path if you are new to
35Android &mdash; make sure that you have a suitable version of Eclipse
36installed on your computer (3.3 or newer). If you need to install Eclipse, you can
37download it from this location: </p>
38
39<p style="margin-left:2em;"><a href=
40"http://www.eclipse.org/downloads/">http://www.eclipse.org/downloads/</a
41></p>
42
43<p>A Java or RCP version of Eclipse is recommended. </p>
44
45<h2 id="installingsdk">Installing the SDK</h2>
46
47<p>After downloading the SDK, unpack the .zip archive to a suitable location on your machine. 
48By default, the SDK files are unpacked into a directory named 
49<code>android_sdk_<em>&lt;platform</em>&gt;_<em>&lt;release&gt;</em></code>. 
50The directory contains a local copy of the documentation (accessible by opening
51<code>documentation.html</code> in your browser) and the subdirectories 
52<code>tools/</code>, <code>add-ons/</code>, <code>platforms/</code>, and others. Inside
53each subdirectory of <code>platforms/</code> you'll find <code>samples/</code>, which includes
54code samples that are specific to each version of the platform.</p>
55
56<p>Make a note of the name and location of the unpacked SDK directory on your system &mdash; you 
57will need to refer to the SDK directory later, when setting up the Android plugin or when 
58using the SDK tools.</p>
59
60<p>Optionally, you may want to add the location of the SDK's primary <code>tools</code> directory 
61to your system PATH. The primary <code>tools/</code> directory is located at the root of the 
62SDK folder. Adding <code>tools</code> to your path lets you run Android Debug Bridge (adb) and 
63the other command line <a href="{@docRoot}guide/developing/tools/index.html">tools</a> without 
64needing to supply the full path to the tools directory. </p>
65<ul>
66    <li>On Linux, edit your <code>~/.bash_profile</code> or <code>~/.bashrc</code> file. Look
67    for a line that sets the PATH environment variable and add the
68    full path to the <code>tools/</code> directory to it. If you don't 
69    see a line setting the path, you can add one:</li>
70
71    <ul><code>export PATH=${PATH}:<em>&lt;your_sdk_dir&gt;</em>/tools</code></ul>
72
73    <li>On a Mac, look in your home directory for <code>.bash_profile</code> and
74    proceed as for Linux. You can create the <code>.bash_profile</code> if 
75    you haven't already set one up on your machine. </li>
76
77    <li>On Windows, right-click on My Computer, and select Properties.  
78  Under the Advanced tab, hit the Environment Variables button, and in the
79  dialog that comes up, double-click on Path (under System Variables). Add the full path to the 
80  <code>tools/</code> directory to the path. </li>
81  </ul>
82
83<p>Note that, if you update your SDK in the future, you 
84should remember to update your PATH settings to point to the new location, if different.</p>
85
86<p>If you will be using the Eclipse IDE as your development environment,
87the next section describes how to install the Android Development Tools plugin and set up Eclipse. 
88If you choose not to use Eclipse, you can 
89develop Android applications in an IDE of your choice and then compile, debug and deploy using
90the tools included in the SDK (skip to <a href="#next">Next Steps</a>).</p>
91
92
93<h2 id="installingplugin">Installing the ADT Plugin for Eclipse</h2>
94
95<p>Android offers a custom plugin for the Eclipse IDE, called Android
96Development Tools (ADT), that is designed to give you a powerful,
97integrated environment in which to build Android applications. It
98extends the capabilites of Eclipse to let you quickly set up new Android
99projects, create an application UI, add components based on the Android
100Framework API, debug your applications using the Android SDK tools, and even export
101signed (or unsigned) APKs in order to distribute your application.</p>
102
103<p>In general, using Eclipse with ADT is a highly recommended
104approach to Android development and is the fastest way to get started.
105(If you prefer to work in an IDE other than Eclipse,
106you do not need to install Eclipse or ADT, instead, you can directly
107use the SDK tools to build and debug your application.)</p>
108
109<p>Once you have Eclipse installed, as described in <a href="#setup">Preparing for 
110Installation</a>, follow the steps below to
111download the ADT plugin and install it in your respective Eclipse
112environment. </p>
113
114<table style="font-size:100%">
115<tr><th>Eclipse 3.3 (Europa)</th><th>Eclipse 3.4 (Ganymede)</th></tr>
116<tr>
117<td width="45%">
118<!-- 3.3 steps -->
119<ol>
120    <li>Start Eclipse, then select <strong>Help</strong> &gt; <strong>Software Updates</strong> 
121&gt; <strong>Find and Install...</strong>. </li>
122    <li>In the dialog that appears, select <strong>Search for new features to install</strong> 
123and click <strong>Next</strong>. </li>
124    <li>Click <strong>New Remote Site</strong>. </li>
125    <li>In the resulting dialog box, enter a name for the remote site (e.g. "Android Plugin") and 
126    enter the URL:
127        <pre>https://dl-ssl.google.com/android/eclipse/</pre>
128        <p>If you have trouble aqcuiring the plugin, try using "http" in the URL,
129        instead of "https" (https is preferred for security reasons).</p>
130        <p>Click <strong>OK</strong>.</p> </li>
131    <li>You should now see the new site added to the search list (and checked).
132        Click <strong>Finish</strong>. </li>
133    <li>In the subsequent Search Results dialog box, select the checkbox for the
134    "Android Plugin".
135    This will select the nested tools: "Android DDMS" and "Android Development Tools". 
136    Click <strong>Next</strong>.</li>
137    <li>Read and accept the license agreement, then click <strong>Next</strong>. </li>
138    <li>On the following Installation window, click <strong>Finish</strong>. </li>
139    <li>The ADT plugin is not digitally signed. Accept the installation anyway
140        by clicking <strong>Install All</strong>. </li>
141    <li>Restart Eclipse. </li>
142</ol>
143
144</td>
145<td>
146
147<!-- 3.4 steps -->
148<ol>
149    <li>Start Eclipse, then select <strong>Help</strong> &gt; <strong>Software Updates...</strong>.</li>
150    <li>In the dialog that appears, click the <strong>Available Software</strong> tab. </li>
151    <li>Click <strong>Add Site...</strong> </li>
152    <li>Enter the Location:
153      <pre>https://dl-ssl.google.com/android/eclipse/</pre>
154        <p>If you have trouble aqcuiring the plugin, try using "http" in the Location URL,
155        instead of "https" (https is preferred for security reasons).</p>   
156      <p>Click <strong>OK</strong>.</p></li>
157    <li>Back in the Available Software view, you should see the plugin listed by the URL,
158    with "Developer Tools" nested within it. Select the checkbox next to 
159      Developer Tools and click <strong>Install...</strong></li>
160    <li>On the subsequent Install window, "Android DDMS" and "Android Development Tools"
161    should both be checked. Click <strong>Next</strong>. </li>
162    <li>Read and accept the license agreement, then click <strong>Finish</strong>.</li>
163    <li>Restart Eclipse. </li>
164</ol>
165
166</td>
167</tr>
168</table>
169
170<p>Now modify your Eclipse preferences to point to the Android SDK directory:</p>
171<ol>
172    <li>Select <strong>Window</strong> &gt; <strong>Preferences...</strong> to open the Preferences
173        panel (Mac: <strong>Eclipse</strong> &gt; <strong>Preferences</strong>).</li>
174    <li>Select <strong>Android</strong> from the left panel. </li>
175    <li>For the <em>SDK Location</em> in the main panel, click <strong>Browse...</strong> and 
176locate your downloaded SDK directory. </li>
177    <li>Click <strong>Apply</strong>, then <strong>OK</strong>.</li>
178</ol>
179
180<p>Done! If you haven't encountered any problems, then you're ready to
181begin developing Android applications. See the 
182<a href="#next">Next Steps</a> section for suggestions on how to start. </p>
183
184
185<h3 id="troubleshooting">Troubleshooting ADT Installation</h3>
186<p> 
187If you are having trouble downloading the ADT plugin after following the steps above, here are 
188some suggestions: </p>
189
190<ul>
191  <li>If Eclipse can not find the remote update site containing the ADT plugin, try changing 
192  the remote site URL to use http, rather than https. That is, set the Location for the remote site to:
193  <pre>http://dl-ssl.google.com/android/eclipse/</pre></li>
194  <li>If you are behind a firewall (such as a corporate firewall), make
195  sure that you have properly configured your proxy settings in Eclipse.
196  In Eclipse 3.3/3.4, you can configure proxy information from the main
197  Eclipse menu in <strong>Window</strong> (on Mac, <strong>Eclipse</strong>) &gt; 
198  <strong>Preferences</strong> &gt; <strong>General</strong> &gt; 
199  <strong>Network Connections</strong>.</li>
200</ul>
201<p> 
202If you are still unable to use Eclipse to download the ADT plugin as a remote update site, you 
203can download the ADT zip file to your local machine and manually install the it:
204</p>
205<ol>
206  <li><a href="{@docRoot}sdk/adt_download.html">Download the ADT zip file</a> (do not unpack it).</li>
207  <li>Follow steps 1 and 2 in the default install instructions (above).</li>
208  <li>In Eclipse 3.3, click <strong>New Archive Site...</strong>. <br/>
209      In Eclipse 3.4, click <strong>Add Site...</strong>, then <strong>Archive...</strong></li>
210  <li>Browse and select the downloaded zip file.</li>
211  <li>Follow the remaining procedures, above, starting from steps 5.</li>
212</ol>
213<p>To update your plugin once you've installed using the zip file, you will have to 
214follow these steps again instead of the default update instructions.</p>
215
216<h4>Other install errors</h4>
217
218<p>Note that there are features of ADT that require some optional 
219Eclipse components (for example, WST). If you encounter an error when 
220installing ADT, your Eclipse installion might not include these components. 
221For information about how to quickly add the necessary components to your 
222Eclipse installation, see the troubleshooting topic 
223<a href="{@docRoot}guide/appendix/faq/troubleshooting.html#installeclipsecomponents">ADT 
224Installation Error: "requires plug-in org.eclipse.wst.sse.ui"</a>.</p>
225
226<h4>For Linux users</h4>
227<p>If you encounter this error when installing the ADT Plugin for Eclipse: 
228<pre>
229An error occurred during provisioning.
230Cannot connect to keystore.
231JKS</pre>
232<p>
233...then your development machine lacks a suitable Java VM. Installing Sun
234Java 6 will resolve this issue and you can then reinstall the ADT
235Plugin.</p>
236
237
238<h2 id="next">Next Steps</h2>
239<p>Once you have completed installation, you are ready to
240begin developing applications. Here are a few ways you can get started: </p>
241
242<p><strong>Learn about Android</strong></p>
243<ul>
244  <li>Take a look at the <a href="{@docRoot}guide/index.html">Dev
245  Guide</a> and the types of information it provides</li>
246  <li>Read an introduction to Android as a platform in <a
247  href="{@docRoot}guide/basics/what-is-android.html">What is
248  Android?</a></li>
249  <li>Learn about the Android framework and how applications run on it in
250  <a href="{@docRoot}guide/topics/fundamentals.html">Application
251  Fundamentals</a></li>
252  <li>Take a look at the Android framework API specification in the <a
253  href="{@docRoot}reference/packages.html">Reference</a> tab</li>
254</ul>
255
256<p><strong>Explore the SDK</strong></p>
257<ul>
258  <li>Get an overview of the <a
259  href="{@docRoot}guide/developing/tools/index.html">development
260  tools</a> that are available to you</li>
261  <li>Read how to develop <a
262  href="{@docRoot}guide/developing/eclipse-adt.html">in Eclipse/ADT</a> or
263  <a href="{@docRoot}guide/developing/other-ide.html">in other IDEs</a>
264  </li>
265</ul>
266
267<p><strong>Explore some code</strong></p>
268<ul>
269  <li>Set up a <a href="{@docRoot}guide/tutorials/hello-world.html">Hello
270  World application</a> (highly recommended, especially for Eclipse users)</li>
271  <li>Follow the <a href="{@docRoot}guide/tutorials/notepad/index.html">
272  Notepad Tutorial</a> to build a full Android application </li>
273  <li>Create a new project for one of the other sample applications
274  included in <code><em>&lt;sdk&gt;</em>/platforms/<em>&lt;platfrom&gt;</em>/samples</code>, 
275  then compile and run it in your development environment</li>
276</ul>
277
278<p><strong>Visit the Android developer groups</strong></p>
279<ul>
280  <li>Take a look at the <a
281  href="{@docRoot}community/index.html">Community</a> tab to see a list of
282  Android developers groups. In particular, you might want to look at the
283  <a href="http://groups.google.com/group/android-developers">Android
284  Developers</a> group to get a sense for what the Android developer
285  community is like.</li>
286</ul>
287
288
289<h2 id="installnotes">Installation Notes</h2>
290
291<h3>Ubuntu Linux Notes</h3>
292
293<ul>
294  <li>If you need help installing and configuring Java on your
295    development machine, you might find these resources helpful: 
296    <ul>
297      <li><a href="https://help.ubuntu.com/community/Java">https://help.ubuntu.com/community/Java </a></li>
298      <li><a href="https://help.ubuntu.com/community/Java">https://help.ubuntu.com/community/JavaInstallation</a></li>
299    </ul>
300  </li>
301  <li>Here are the steps to install Java and Eclipse, prior to installing
302  the Android SDK and ADT Plugin.
303    <ol>
304      <li>If you are running a 64-bit distribution on your development
305      machine, you need to install the <code>ia32-libs</code> package using
306      <code>apt-get:</code>:
307      <pre>apt-get install ia32-libs</pre>
308      </li>
309      <li>Next, install Java: <pre>apt-get install sun-java6-bin</pre></li>
310      <li>The Ubuntu package manager does not currently offer an Eclipse 3.3
311      version for download, so we recommend that you download Eclipse from
312      eclipse.org (<a
313      href="http://www.eclipse.org/downloads/">http://www.eclipse.org/
314      downloads/</a>). A Java or RCP version of Eclipse is recommended.</li>
315      <li>Follow the steps given in previous sections to install the SDK 
316      and the ADT plugin. </li>
317    </ol>
318  </li>
319</ul>
320
321<h3>Other Linux Notes</h3>
322
323<ul>
324  <li>If JDK is already installed on your development computer, please
325  take a moment to make sure that it meets the version requirements listed
326  in the <a href="{@docRoot}sdk/1.1_r1/requirements.html">System Requirements</a>.
327  In particular, note that some Linux distributions may include JDK 1.4 or Gnu
328  Compiler for Java, both of which are not supported for Android development.</li>
329</ul>
330
331
332
333