Installing the SDK
You should have already downloaded the Android SDK. Now
you need to set up your development environment.
The SDK you've downloaded is not the complete SDK environment. It includes only the core SDK tools, which you can
use to download the rest of the SDK packages (such as the latest system image).
Getting started on Windows
Your download package is an executable file that starts an installer. The installer checks your machine
for required tools, such as the proper Java SE Development Kit (JDK) and installs it if necessary.
The installer then saves the Android SDK Tools into a default location (or you can specify the location).
Make a note of the name and location of the SDK directory on your system—you will need to
refer to the SDK directory later, when setting up the ADT plugin and when using
the SDK tools from the command line.
Once the tools are installed, the installer offers to start the Android SDK Manager. Start it and
continue with the installation guide by clicking the
Next link on the right.
Adding Platforms and Packages
The Android SDK separates tools, platforms, and other components into packages you can
download using the Android SDK Manager. The original
SDK package you've downloaded includes only the SDK Tools. To develop an Android app,
you also need to download at least one Android platform and the latest SDK Platform-tools.
You can update and install SDK packages at any time using the Android SDK Manager.
If you've used the Windows installer to install the SDK tools, you should already have the
Android SDK Manager open. Otherwise, you can launch the Android SDK Manager in one of the following
ways:
- On Windows, double-click the
SDK Manager.exe
file at the root of the Android SDK directory. - On Mac or Linux, open a terminal and navigate to the
tools/
directory in the Android SDK, then executeandroid sdk
.
When you open the Android SDK Manager, it automatically selects a set of recommended packages.
Simply click Install to install the recommended packages. The Android SDK Manager
installs the selected packages into
your Android SDK environment. The following sections describe some of the available SDK
packages and more about which ones we recommend you install.
Once you have installed your packages, continue to the next page.
Recommended Packages
Here's an outlines of the packages required and those we recommend you use:
- SDK Tools
- Required. Your new SDK installation already has the latest version. Make sure you keep this up to date.
- SDK Platform-tools
- Required. You must install this package when you install the SDK for the first time.
- SDK Platform
- Required.You must download at least one platform into your environment so you're able to compile your application. In order to provide the best user experience on the latest devices, we recommend that you use the latest platform version as your build target. You'll still be able to run your app on older versions, but you must build against the latest version in order to use new features when running on devices with the latest version of Android. To get started, download the latest Android version, plus the lowest version you plan to support (we recommend Android 2.2 for your lowest version).
- System Image
- Recommended. Although you might have one or more Android-powered devices on which to test your app, it's unlikely you have a device for every version of Android your app supports. It's a good practice to download system images for all versions of Android your app supports and test your app running on them with the Android emulator.
- Android Support
- Recommended. Includes a static library that allows you to use some of the latest Android APIs (such as fragments, plus others not included in the framework at all) on devices running a platform version as old as Android 1.6. All of the activity templates available when creating a new project with the ADT Plugin require this. For more information, read Support Library.
- SDK Samples
- Recommended. The samples give you source code that you can use to learn about Android, load as a project and run, or reuse in your own app. Note that multiple samples packages are available — one for each Android platform version. When you are choosing a samples package to download, select the one whose API Level matches the API Level of the Android platform that you plan to use.
Android offers a custom plugin for the Eclipse IDE, called Android
Development Tools (ADT). This plugin is designed to give you a powerful, integrated
environment in which to develop Android apps. It extends the capabilities
of Eclipse to let you quickly set up new Android projects, build an app
UI, debug your app, and export signed (or unsigned) app packages (APKs) for distribution.
If you will be developing in Eclipse with the ADT Plugin, first make sure that you have a
suitable version of Eclipse
installed on your computer as described by the
system requirements.
If you need to install Eclipse, you can download it from http://www.eclipse.org/downloads/.
We recommend the "Eclipse Classic" version. Otherwise, you should use a Java or
RCP version of Eclipse.
Note: If you prefer to work in a different IDE, you do not need to
install Eclipse or ADT. Instead, you can directly use the SDK tools to build and
debug your application. So if you're not using Eclipse, continue to the next page by clicking
the Next link on the right.
Download the ADT Plugin
- Start Eclipse, then select Help > Install New Software.
- Click Add, in the top-right corner.
- In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the
following URL for the Location:
https://dl-ssl.google.com/android/eclipse/
- Click OK. If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of "https" (https is preferred for security reasons).
- In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
- In the next window, you'll see a list of the tools to be downloaded. Click Next.
- Read and accept the license agreements, then click Finish. If you get a security warning saying that the authenticity or validity of the software can't be established, click OK.
- When the installation completes, restart Eclipse.
Configure the ADT Plugin
Once Eclipse restarts, you
must specify the location of your Android SDK directory:
- In the "Welcome to Android Development" window that appears, select Use existing SDKs.
- Browse and select the location of the Android SDK directory you recently downloaded.
- Click Next.
If you haven't encountered any errors, you're done setting up ADT .
Updating the ADT Plugin
From time to time, a new revision of the ADT Plugin becomes available, with
new features and bug fixes. Generally, when a new revision of ADT is available,
you should update to it as soon as convenient.
In some cases, a new revision of ADT will have a dependency on a specific
revision of the Android SDK Tools. If such dependencies exist, you will need to
update the SDK Tools package of the SDK after installing the new revision of
ADT. To update the SDK Tools package, use the Android SDK Manager, as
described in Exploring the SDK.
To learn about new features of each ADT revision and also any dependencies on
the SDK Tools, see the listings in the Revisions
section. To determine the version currently installed, open the
Eclipse Installed Software window using Help
> Software Updates and refer to the version listed for
"Android Development Tools".
Follow the steps below to check whether an update is available and, if so,
to install it.
- Select Help > Check for Updates. If there are no updates available, a dialog will say so and you're done.
- If there are updates available, select Android DDMS, Android Development Tools, and Android Hierarchy Viewer, then click Next.
- In the Update Details dialog, click Next.
- Read and accept the license agreement and then click Finish. This will download and install the latest version of Android DDMS and Android Development Tools.
- Restart Eclipse.
If you encounter problems during the update, remove the existing ADT plugin from Eclipse, then
perform a fresh installation, using the instructions for Installing the ADT
Plugin.
Troubleshooting
If you are having trouble downloading the ADT plugin after following the
steps above, here are some suggestions:
- If Eclipse can not find the remote update site containing the ADT plugin,
try changing the remote site URL to use http, rather than https. That is, set
the Location for the remote site to:
http://dl-ssl.google.com/android/eclipse/
- If you are behind a firewall (such as a corporate firewall), make sure that you have properly configured your proxy settings in Eclipse. In Eclipse, you can configure proxy information from the main Eclipse menu in Window (on Mac OS X, Eclipse) > Preferences > General > Network Connections.
If you are still unable to use Eclipse to download the ADT plugin as a
remote update site, you can download the ADT zip file to your local machine and
manually install it:
- Download the ADT Plugin zip file (do not unpack it):
Package Size MD5 Checksum ADT-20.0.3.zip 12390954 bytes 869a536b1c56d0cd920ed9ae259ae619 - Start Eclipse, then select Help > Install New Software.
- Click Add, in the top-right corner.
- In the Add Repository dialog, click Archive.
- Select the downloaded ADT-20.0.3.zip file and click OK.
- Enter "ADT Plugin" for the name and click OK.
- In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
- In the next window, you'll see a list of the tools to be downloaded. Click Next.
- Read and accept the license agreements, then click Finish. If you get a security warning saying that the authenticity or validity of the software can't be established, click OK.
- When the installation completes, restart Eclipse.
To update your plugin once you've installed using the zip file, you will have
to follow these steps again instead of the default update instructions.
Other install errors
Note that there are features of ADT that require some optional
Eclipse packages (for example, WST). If you encounter an error when
installing ADT, your Eclipse installion might not include these packages.
For information about how to quickly add the necessary packages to your
Eclipse installation, see the troubleshooting topic
ADT
Installation Error: "requires plug-in org.eclipse.wst.sse.ui".
Now that you've installed the Android SDK, here are are a few ways to learn Android
and start developing:
Start coding
- Follow the training class for Building Your First App.
This class is an essential first step for new Android developers.
It gives you step by step instructions for building a simple app. You’ll learn how to create an Android project and run a debuggable version of the app. You'll also learn some fundamentals of Android app design, including how to build a simple user interface and handle user input.
Comments
Post a Comment