Home | History | Annotate | Download | only in sdk
      1 page.title=Adding SDK Components
      2 @jd:body
      3 
      4 
      5 <div id="qv-wrapper">
      6 <div id="qv">
      7 <h2>Quickview</h2>
      8 <ul>
      9   <li>Use the Android SDK and AVD Manager to
     10    set up your SDK and keep it up-to-date.</li>
     11 </ul>
     12 
     13 <h2>In this document</h2>
     14 <ol>
     15   <li><a href="#launching">Launching the Android SDK and AVD Manager</a>
     16   <li><a href="#InstallingComponents">Installing SDK Components</a>
     17   <li><a href="#UpdatingComponents">Updating SDK Components</a>
     18   <li><a href="#dependencies">Component Dependencies</a></li>
     19   <li><a href="#AddingSites">Adding New Sites</a></li>
     20   <li><a href="#troubleshooting">Troubleshooting</a></li>
     21 </ol>
     22 </div>
     23 </div>
     24 
     25 <p>Adding and updating components in your Android SDK is fast and easy. To add or
     26 update the individual SDK components that you need, use the <em>Android SDK and AVD
     27 Manager</em> (included in the SDK Tools).</p>
     28 
     29 <p>It only takes a couple of clicks to install individual versions of the
     30 Android platform, new development tools, new documentation, and SDK add-ons. The
     31 new SDK components are automatically installed into your existing SDK directory,
     32 so you don't need to update your development environment to specify a new SDK
     33 location.</p>
     34 
     35 <p>If you're setting up your Android SDK for the first time,
     36 see <a href="{@docRoot}sdk/installing.html#components">Installing the SDK</a> for information about
     37 what components to install.</p>
     38 
     39 <p class="note"><strong>Note:</strong> If you develop in Eclipse, you might also need
     40 to update your ADT plugin when you update your development tools. See the revisions listed in the
     41 <a href="{@docRoot}sdk/eclipse-adt.html">ADT Plugin for Eclipse</a> document.</p>
     42 
     43 <img src="{@docRoot}images/sdk_manager_packages.png" alt="" />
     44 <p class="img-caption"><strong>Figure 1.</strong> The Android SDK and AVD Manager's
     45 <strong>Available Packages</strong> panel, which shows the SDK components that are
     46 available for you to download into your environment. </p>
     47 </div>
     48 
     49 <h2 id="launching">Launching the Android SDK and AVD Manager</h2>
     50 
     51 <p>The Android SDK and AVD Manager is the tool that you use to install and
     52 upgrade SDK components in your development environment. </p>
     53 
     54 <p>You can launch the Android SDK and AVD Manager in one of the following ways.</p>
     55 
     56 <h4>Launching from Eclipse/ADT</h4>
     57 
     58 <p>If you are developing in Eclipse and have already installed the ADT Plugin,
     59 follow these steps to access the Android SDK and AVD Manager tool:</p>
     60 
     61 <ol>
     62 <li>Open Eclipse</li>
     63 <li>Select <strong>Window</strong> &gt; <strong>Android SDK and AVD
     64 Manager</strong>.</li>
     65 </ol>
     66 
     67 <h4>Launching from the SDK Manager script (Windows only)</h4>
     68 
     69 <p>For Windows only, the SDK includes a script that invokes the Android SDK and
     70 AVD Manager. To launch the tool using the script, double-click {@code SDK
     71 Manager.exe} at the root of the the SDK directory.</p>
     72 
     73 <h4>Launching from a command line</h4>
     74 
     75 <p>In all development environments, follow these steps to access the Android SDK
     76 and AVD Manager tool from the command line: </p>
     77 
     78 <ol>
     79 <li>Navigate to the <code>&lt;<em>sdk</em>&gt;/tools/</code> directory.</li>
     80 <li>Execute the {@code android} tool command with no options.
     81   <pre style="width:400px">$ android</pre></li>
     82 </ol>
     83 
     84 
     85 <h2 id="InstallingComponents">Installing SDK Components</h2>
     86 
     87 <p class="caution"><strong>Caution:</strong> Before you install SDK components,
     88 we recommend that you disable any antivirus software that may be running on
     89 your computer. There are cases in which antivirus software on Windows is known to interfere with the
     90 installation process, so we suggest you disable your antivirus until installation is
     91 complete.</p>
     92 
     93 <p>Follow these steps to install new SDK components in your environment:</p>
     94 
     95 <ol>
     96   <li>Launch the Android SDK and AVD Manager as described in the section above.</li>
     97   <li>Select <strong>Available Packages</strong> in the left panel.
     98   This will reveal all of the components that are currently available for download
     99   from the SDK repository.</li>
    100   <li>Select the component(s) you'd like to install and click <strong>Install
    101   Selected</strong>. (If you aren't sure which packages to select, read <a
    102   href="installing.html#which">Recommended Components</a>.)</li>
    103   <li>Verify and accept the components you want (ensure each one is selected with a green
    104 checkmark) and click <strong>Install</strong>. The components will now be installed into
    105 your existing Android SDK directories.</li>
    106 </ol>
    107 
    108 <p>New platforms are automatically saved into the
    109 <code>&lt;sdk&gt;/platforms/</code> directory of your SDK;
    110 new add-ons are saved in the <code>&lt;sdk&gt;/add-ons/</code>
    111 directory; samples are saved in the
    112 <code>&lt;sdk&gt;/samples/android-&lt;level&gt;/</code>;
    113 and new documentation is saved in the existing
    114 <code>&lt;sdk&gt;/docs/</code> directory (old docs are replaced).</p>
    115 
    116 
    117 <h2 id="UpdatingComponents">Updating SDK Components</h2>
    118 
    119 <p>From time to time, new revisions of existing SDK components are released and
    120 made available to you through the SDK repository. In most cases, if you have those
    121 components installed in your environment, you will want
    122 to download the new revisions as soon as possible. </p>
    123 
    124 <p>You can learn about the release of new revisions in two ways: </p>
    125 
    126 <ul>
    127 <li>You can watch for updates listed in the "SDK" tab of the Android Developers
    128 site, in the "Downloadable SDK Components" section. </li>
    129 <li>You can watch for updates listed in the <strong>Available Packages</strong>
    130 panel of the Android SDK and AVD Manager. </li>
    131 </ul>
    132 
    133 <p>When you see that a new revision is available, you can use the Android SDK
    134 and AVD Manager to quickly download it to your environment. Follow the same
    135 procedure as given in <a href="#InstallingComponents">Installing SDK Components</a>, above. The new
    136 component is installed in place of the old, but without impacting your
    137 applications. </p>
    138 
    139 <p class="note"><strong>Tip:</strong>
    140 Use the "Display updates only" checkbox to show only the components
    141 you do not have.</p>
    142 
    143 
    144 <h2 id="dependencies">SDK Component Dependencies</h2>
    145 
    146 <p>In some cases, an SDK component may require a specific minimum revision of
    147 another component or SDK tool. Where such dependencies exist, they are
    148 documented in the revision notes for each component, available from the links in
    149 the "Downloadable SDK Components" section at left.</p>
    150 
    151 <p>For example, there may be a dependency between the ADT Plugin for Eclipse and
    152 the SDK Tools component. When you install the SDK Tools
    153 component, you should also upgrade to the required version of ADT (if you
    154 are developing in Eclipse). In this case,  the major version number for your ADT plugin should
    155 always match the revision number of your SDK Tools (for example, ADT 8.x requires SDK Tools r8).
    156 </p>
    157 
    158 <p>Also make sure that, each time you install a new version of the Android platform, you have
    159 the latest version of the SDK Platform-tools component. The SDK Platform-tools contain
    160 tools that are backward compatible with all versions of the Android platform and are
    161 often updated to support new features in the latest version of the Android platform.</p>
    162 
    163 <p>The development tools will notify you with debug warnings if there is dependency that you need to
    164 address. The SDK and AVD Manager also enforces dependencies by requiring that you download any
    165 components that are needed by those you have selected.</p>
    166 
    167 
    168 <h2 id="AddingSites">Adding New Sites</h2>
    169 
    170 <p>By default, <strong>Available Packages</strong> displays components available from the
    171 <em>Android Repository</em> and <em>Third party Add-ons</em>. You can add other sites that host
    172 their own Android SDK add-ons, then download the SDK add-ons
    173 from those sites.</p>
    174 
    175 <p>For example, a mobile carrier or device manufacturer might offer additional
    176 API libraries that are supported by their own Android-powered devices. In order
    177 to develop using their libraries, you must install their Android SDK add-on, if it's not already
    178 available under <em>Third party Add-ons</em>. </p>
    179 
    180 <p>If a carrier or device manufacturer has hosted an SDK add-on repository file
    181 on their web site, follow these steps to add their site to the SDK and AVD
    182 Manager:</p>
    183 
    184 <ol>
    185   <li>Select <strong>Available Packages</strong> in the left panel.</li>
    186   <li>Click <strong>Add Add-on Site</strong> and enter the URL of the
    187 {@code repository.xml} file. Click <strong>OK</strong>.</li>
    188 </ol>
    189 <p>Any SDK components available from the site will now be listed under a new item named
    190 <strong>User Add-ons</strong>.</p>
    191 
    192 
    193 <h2 id="troubleshooting">Troubleshooting</h2>
    194 
    195 <p><strong>Problems connecting to the SDK repository</strong></p>
    196 
    197 <p>If you are using the SDK and AVD Manager to download components and are encountering
    198 connection problems, try connecting over http, rather than https. To switch the
    199 protocol used by the SDK and AVD Manager, follow these steps: </p>
    200 
    201 <ol>
    202   <li>With the Android SDK and AVD Manager window open, select "Settings" in the
    203   left pane. </li>
    204   <li>On the right, in the "Misc" section, check the checkbox labeled "Force
    205   https://... sources to be fetched using http://..." </li>
    206   <li>Click <strong>Save &amp; Apply</strong>.</li>
    207 </ol>
    208 
    209 
    210