page.title=Adding SDK Components @jd:body

Quickview

In this document

  1. Launching the Android SDK and AVD Manager
  2. Installing SDK Components
  3. Updating SDK Components
  4. Component Dependencies
  5. Adding New Sites
  6. Troubleshooting

Adding and updating components in your Android SDK is fast and easy. To add or update the individual SDK components that you need, use the Android SDK and AVD Manager (included in the SDK Tools).

It only takes a couple of clicks to install individual versions of the Android platform, new development tools, new documentation, and SDK add-ons. The new SDK components are automatically installed into your existing SDK directory, so you don't need to update your development environment to specify a new SDK location.

If you're setting up your Android SDK for the first time, see Installing the SDK for information about what components to install.

Note: If you develop in Eclipse, you might also need to update your ADT plugin when you update your development tools. See the revisions listed in the ADT Plugin for Eclipse document.

Figure 1. The Android SDK and AVD Manager's Available Packages panel, which shows the SDK components that are available for you to download into your environment.

Launching the Android SDK and AVD Manager

The Android SDK and AVD Manager is the tool that you use to install and upgrade SDK components in your development environment.

You can launch the Android SDK and AVD Manager in one of the following ways.

Launching from Eclipse/ADT

If you are developing in Eclipse and have already installed the ADT Plugin, follow these steps to access the Android SDK and AVD Manager tool:

  1. Open Eclipse
  2. Select Window > Android SDK and AVD Manager.

Launching from the SDK Manager script (Windows only)

For Windows only, the SDK includes a script that invokes the Android SDK and AVD Manager. To launch the tool using the script, double-click {@code SDK Manager.exe} at the root of the the SDK directory.

Launching from a command line

In all development environments, follow these steps to access the Android SDK and AVD Manager tool from the command line:

  1. Navigate to the <sdk>/tools/ directory.
  2. Execute the {@code android} tool command with no options.
    $ android

Installing SDK Components

Caution: Before you install SDK components, we recommend that you disable any antivirus software that may be running on your computer. There are cases in which antivirus software on Windows is known to interfere with the installation process, so we suggest you disable your antivirus until installation is complete.

Follow these steps to install new SDK components in your environment:

  1. Launch the Android SDK and AVD Manager as described in the section above.
  2. Select Available Packages in the left panel. This will reveal all of the components that are currently available for download from the SDK repository.
  3. Select the component(s) you'd like to install and click Install Selected. (If you aren't sure which packages to select, read Recommended Components.)
  4. Verify and accept the components you want (ensure each one is selected with a green checkmark) and click Install. The components will now be installed into your existing Android SDK directories.

New platforms are automatically saved into the <sdk>/platforms/ directory of your SDK; new add-ons are saved in the <sdk>/add-ons/ directory; samples are saved in the <sdk>/samples/android-<level>/; and new documentation is saved in the existing <sdk>/docs/ directory (old docs are replaced).

Updating SDK Components

From time to time, new revisions of existing SDK components are released and made available to you through the SDK repository. In most cases, if you have those components installed in your environment, you will want to download the new revisions as soon as possible.

You can learn about the release of new revisions in two ways:

When you see that a new revision is available, you can use the Android SDK and AVD Manager to quickly download it to your environment. Follow the same procedure as given in Installing SDK Components, above. The new component is installed in place of the old, but without impacting your applications.

Tip: Use the "Display updates only" checkbox to show only the components you do not have.

SDK Component Dependencies

In some cases, an SDK component may require a specific minimum revision of another component or SDK tool. Where such dependencies exist, they are documented in the revision notes for each component, available from the links in the "Downloadable SDK Components" section at left.

For example, there may be a dependency between the ADT Plugin for Eclipse and the SDK Tools component. When you install the SDK Tools component, you should also upgrade to the required version of ADT (if you are developing in Eclipse). In this case, the major version number for your ADT plugin should always match the revision number of your SDK Tools (for example, ADT 8.x requires SDK Tools r8).

Also make sure that, each time you install a new version of the Android platform, you have the latest version of the SDK Platform-tools component. The SDK Platform-tools contain tools that are backward compatible with all versions of the Android platform and are often updated to support new features in the latest version of the Android platform.

The development tools will notify you with debug warnings if there is dependency that you need to address. The SDK and AVD Manager also enforces dependencies by requiring that you download any components that are needed by those you have selected.

Adding New Sites

By default, Available Packages displays components available from the Android Repository and Third party Add-ons. You can add other sites that host their own Android SDK add-ons, then download the SDK add-ons from those sites.

For example, a mobile carrier or device manufacturer might offer additional API libraries that are supported by their own Android-powered devices. In order to develop using their libraries, you must install their Android SDK add-on, if it's not already available under Third party Add-ons.

If a carrier or device manufacturer has hosted an SDK add-on repository file on their web site, follow these steps to add their site to the SDK and AVD Manager:

  1. Select Available Packages in the left panel.
  2. Click Add Add-on Site and enter the URL of the {@code repository.xml} file. Click OK.

Any SDK components available from the site will now be listed under a new item named User Add-ons.

Troubleshooting

Problems connecting to the SDK repository

If you are using the SDK and AVD Manager to download components and are encountering connection problems, try connecting over http, rather than https. To switch the protocol used by the SDK and AVD Manager, follow these steps:

  1. With the Android SDK and AVD Manager window open, select "Settings" in the left pane.
  2. On the right, in the "Misc" section, check the checkbox labeled "Force https://... sources to be fetched using http://..."
  3. Click Save & Apply.