How to install the Android SDK (Software Development Kit)
The Android Software Development Kit (SDK) allows developers to create applications for the Android platform. The Android SDK includes sample projects with source code, development tools, an emulator, and required libraries to build Android applications which are written using the Java programming language.
Much of the info in this guide comes from the documentation on the Android Developers site. Follow this quick guide to successfully install Android SDK on your computer. If you are new to it, it is a bit complicated to install compared to your usual program. However if you are good in following instructions, it’s as easy as A-B-C.
The process involves four general steps:
- Meeting System Requirements
- Fetching the Android SDK Package
- Installing the Android Development Tools (ADT) Plugin for Eclipse
- Adding Android Platforms and Components
For instructions specific to your particular operating system, hop over to the last section entitled “Specific Instructions According to OS.
Step 1: Get Ready Your Computer
Before anything else, see to it that your computer meets the minimum system requirements. Specifically, you might need to install the Java Development Kit (JDK), if you don’t have it yet.
The following outlines the system and software requirements for developing Android applications using the Android SDK.
Supported Operating Systems
- Windows XP or Vista
- Mac OS X 10.4.8 or later (x86 only)
- Linux (tested on Linux Ubuntu Dapper Drake)
Supported Development Environments
Eclipse Integreted Development Environment (IDE)
- Eclipse 3.5 (Galileo) or greater. Note: Eclipse 3.4 (Ganymede) is no longer supported with the latest version of ADT.
- Eclipse JDT plugin (included in most Eclipse IDE packages)
- If you need to install or update Eclipse, you can download it here. Several types of Eclipse packages are available for each platform. For developing Android applications, we recommend that you install one of these packages:
- Eclipse IDE for Java Developers
- Eclipse Classic (versions 3.5.1 and higher)
- Eclipse IDE for Java EE Developers
- Note: Not compatible with GNU Compiler for Java (gcj)
Other development environments or IDEs
- JDK 5 or JDK 6 (JRE alone is not sufficient)
- Apache Ant 1.8 or later
- Note: Not compatible with GNU Compiler for Java (gcj)
If Java Development Kit (JDK) is already installed on your development computer, make sure that it meets the version requirements listed above. In particular, note that some Linux distributions may include JDK 1.4 or GNU Compiler for Java, both of which are not supported for Android development.
Step 2: Download the SDK Starter Package
The SDK Starter Package is not a full development environment. It only includes the core SDK Tools, which you can use to download the rest of the SDK components (such as the latest Android platform).
To get the latest version of the SDK starter package, go to the Android SDK download page and download the package for your machine’s operating system.
Step 3: Install the ADT Plugin for Eclipse
Android offers a custom Eclipse IDE plugin called Android Development Tools (ADT) designed to give you a powerful, integrated environment in which to build Android applications. It extends the capabilities of Eclipse to let you quickly set up new Android projects, create an application UI, debug your applications using the Android SDK tools, and even export signed (or unsigned) APKs in order to distribute your application. In general, developing in Eclipse with ADT is a highly recommended approach and is the fastest way to get started with Android.
If you will be developing in Eclipse with the Android Development Tools (ADT) Plugin, follow the steps to download the ADT here.
Otherwise, you do not need to install Eclipse or ADT. Instead, you can directly use the SDK tools to build and debug your application.
Step 4: Download and Add Platforms and Other Components
The last step in setting up your SDK is using the Android SDK and AVD Manager (a tool included in the SDK starter package) to download essential SDK components into your development environment.
Launching Android SDK and AVD Manager
You can launch the Android SDK and AVD Manager in any of the following ways:
- From within Eclipse, select Window > Android SDK and AVD Manager.
- 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 type
androidon the terminal window and press Enter.
To download components, use the graphical UI of the Android SDK and AVD Manager to browse the SDK repository and select new or updated components (see Figure 1). The Android SDK and AVD Manager installs the selected components in your SDK environment. For information about which components you should download, see Recommended Components.
By default, there are two repositories of components for your SDK: Android Repository and Third-party Add-ons.
The Android Repository offers these types of components:
- SDK Tools (pre-installed in the Android SDK starter package) — Contains tools for debugging and testing your application and other utility tools. You can access these in the <sdk>/tools/ directory of your SDK. You can read the documentation about these tools on the Android developer site.
- SDK Platform-tools — Contains tools that are required to develop and debug your application, but which are developed alongside the Android platform in order to support the latest features. These tools are typically updated only when a new platform becomes available. You can access these in the <sdk>/platform-tools/ directory. You can read the documentation about these tools on the Android developer site. Among the tools is the Android Debug Bridge, more fondly known as ADB. It is a frequently used tool among app developers and those who customize their phones. Check our guide on how to setup and use ADB (Android Debug Bridge).
- Android platforms — An SDK platform is available for every production Android platform deployable to Android-powered devices. Each platform component includes a fully compliant Android library and system image, sample code, emulator skins, and any version-specific tools.
- USB Driver for Windows (Windows only) — Contains driver files that you can install on your Windows computer, so that you can run and debug your applications on an actual device. You do not need the USB driver unless you plan to debug your application on an actual Android-powered device. If you develop on Mac OS X or Linux, you do not need a special driver to debug your application on an Android-powered device.
- Samples — Contains the sample code and apps available for each Android development platform. If you are just getting started with Android development, make sure to download the samples to your SDK.
- Documentation — Contains a local copy of the latest multiversion documentation for the Android framework API.
The Third-party Add-ons provide components that allow you to create a development environment using a specific Android external library (such as the Google Maps library) or a customized (but fully compliant) Android system image. You can add additional add-on repositories by clicking Add Add-on Site on the Android SDK and AVD Manager window.
The SDK repository gives you a lot of downloadable components for your Android SDK, but do you need to download all of them? To answer that, you can refer to the following table which describes the recommended downloads for a basic, recommended, or full development environment:
|Basic||SDK Tools||If you’ve just installed the SDK starter package, then you already have the latest version of this component. The SDK Tools component is required to develop an Android application. Make sure you keep this up to date.|
|SDK Platform-tools||This includes more tools that are required for application development. These tools are platform-dependent and typically update only when a new SDK platform is made available, in order to support new features in the platform. These tools are always backward compatible with older platforms, but you must be sure that you have the latest version of these tools when you install a new SDK platform.|
|SDK platform||You need to download at least one platform into your environment, so that you will be able to compile your application and set up an Android Virtual Device (AVD) to run it on (in the emulator). To start with, just download the latest version of the platform. Later, if you plan to publish your application, you will want to download other platforms as well, so that you can test your application on the full range of Android platform versions that your application supports.|
|Recommended (plus Basic)||Documentation||The Documentation component is useful because it lets you work offline and also look up API reference information from inside Eclipse.|
|Samples||The Samples components 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 components are available — one for each Android platform version. When you are choosing a samples component to download, select the one whose API Level matches the API Level of the Android platform that you plan to use.|
|Usb Driver||The Usb Driver component is needed only if you are developing on Windows and have an Android-powered device on which you want to install your application for debugging and testing. For Mac OS X and Linux platforms, no special driver is needed.|
|Full (plus Recommended)||Google APIs||The Google APIs add-on gives your application access to the Maps external library, which makes it easy to display and manipulate Maps data in your application.|
|Additional SDK Platforms||If you plan to publish your application, you will want to download additional platforms corresponding to the Android platform versions on which you want the application to run. The recommended approach is to compile your application against the lowest version you want to support, but test it against higher versions that you intend the application to run on. You can test your applications on different platforms by running in an Android Virtual Device (AVD) on the Android emulator.|
Once you’ve installed at least the basic configuration of SDK components, you’re ready to start developing Android apps.
Specific Instructions According to OS
This section provides OS-specific instructions for installing the Android SDK.
Installing on Linux
The package android-sdk is included in AUR. No further changes are needed.
- On a terminal window, install the Android SDK by typing
emerge dev-util/android-sdk-update-managerand pressing Enter.
- Launch the Android SDK and AVD Manager by typing
/opt/android-sdk-update-manager/tools/androidon the terminal and pressing Enter.
- Install the “platform-tools” package.
- ADB will be lcoated at /opt/android-sdk-update-manager/platform-tools/adb
- Edit your .bashrc file and add this line:
Installing on Mac OS X
Installing the Android SDK
- Download the latest version of Android SDK for Mac. Get it here.
- Open Terminal.app (in /Applications/Utilities)
- Unzip it and move it where needed
unzip Downloads/android-sdk_r09-mac_86.zip -d~/bin
- Edit ~/.profile and append the path to the executable binary files:
- Load the new (edited) .profile
- Run Android SDK Manager by using the command
- Install components
Installing the Eclipse IDE on Mac OS X
- Download the latest version of Eclipse (Classic or Java Developers are probably best) for Mac OS X. Get it here.
- Open Terminal.app (in /Applications/Utilities)
- Unzip the package and move it where needed.
tar -zxvf Downloads/eclipse-java-helios-SR1-macosx-cocoa-x86_64.tar.gz
- Open Eclipse
- Open Preferences, go to Android. Set your SDK location. Click OK.
- Go to Help > Install New Software
- Click Add.
- Install pieces that you want.
- Download the latest version of Android SDK for Windows from the Android SDK downloads page.
- Unzip the package to the root of C:. (NOTE: This will output a folder called “android-sdk-windows”)
- Open up the android-sdk-windows folder and launch the SDK Manager.
- When you launch the SDK Manager for the first time it will ask for which packages to install. The only package we are concerned with at this time is “Android SDK Platform-tools, revision 6″. You can reject all the others if you are not interested in them.
- Once that is finished, you will need to install the USB drivers included with the Android SDK.
- Click on”Available Packages” on the left.
- Expand “Third party Add-ons”.
- Expand “Google Inc. add-ons”.
- Check “Google USB Driver package, revision 4″.
- Click “Installed Selected”.
- Once that’s finished installing, you can close the SDK Manager.
- Go to the Control Panel, and select the System Properties (Windows XP) or System (Windows Vista/7).
- Select the Advanced settings. (On Windows XP: Click on the Advanced tab. On Windows Vista/7: Click on Advanced system settings on the left.)
- Click on Environment Variables.
- Under the “System variable” section, you will look for “Path”. Double-click on it.
- In the “Variable values” section, add at the very end the location of the tools & package-tools folder, with a semicolon separating these two paths from the rest. (e.g. %SystemRoot%;C:android-sdk-windowsplatform-tools;C:android-sdk-windowstools)
- On your Android device, ensure that USB Debugging is enabled (Settings » Applications » Development).
- Plug the device into the computer via USB cable. The computer will attempt to install the drivers automatically.
- On success, open a command prompt on the computer, and type in the following command to sure everything is setup properly:
- If it lists any devices, everything is fine and you are finished. If not, the drivers may not be installed correctly, please continue.
- Open the Device Manager as follows:
- Right-click on My Computer (Windows XP) or Computer (Windows Vista/7).
- Click on Manage.
- Click on Device Manager on the left.
- You will probably see Unknown Device with ADB listed under it with a yellow exclamation mark.
- Right-click on ADB.
- Click on “Update Driver Software”.
- Click on “Browse my computer for driver software”.
- Click on “Let me pick from a list of device drivers on my computer”.
- Click on “Have Disk”.
- Click on “Browse”.
- Navigate to “C:android-sdk-windowsextrasgoogleusb_driver” and select “android_winusb.inf”.
- Click on “Android ADB Interface”. (NOTE: You will get an Update Driver Warning, click on “Yes”.)
- Once finished installing the driver, open a command prompt on the computer, and type in the following command to sure everything is setup properly:
- If it lists any devices, everything is fine and you are finished. If not, try restarting Windows. If you still can’t see your device, you may have further issues and will have to do further research on your own.
Reference: Android Developers