Mobile
Article

Quick Tip: Installing the Android SDK

By Donald Dragoti

This article was peer reviewed by Adrian Sandu. Thanks to all of SitePoint’s peer reviewers for making SitePoint content the best it can be!

To develop Android apps you will need the Android SDK (Software Development Kit) installed on your machine. As there are several different ways to do so, in this quick tip I will present the options available and why you might want to choose one over another.

Android Studio

The simplest way to install the Android SDK is by downloading Android Studio, the official Android IDE (Integrated Development Environment) from Google and JetBrains. If you plan to create Android applications with cross-platform tools such as Cordova, Ionic or React Native, Android Studio is far more than you need. Or perhaps you need the Android SDK just for building and testing apps built by others. In these cases, installing the standalone SDK is all you need, and again, there are a couple of options.

Java JDK

To install the Android SDK on any platform, you will need a Java JDK installed. Download this from the Oracle website for all major platforms.

Linux

apt-get install sun-java6-jdk

If your distribution is 64-bit, run this command first to install the required x86 libraries:

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386

Installing and Configuring the SDK

Windows

Choose the first option from the download page which will download an .exe file. After the download has finished, double click and start the installation.

You can change the installation location to wherever you want, but for simplicity, leave it as is.

After the installation completes you will need to change the Windows environment variables so the adb (DEFINITION) server can start anywhere.

  1. Open Control Panel
  2. Click System and on the left hand side select, Advanced system settings.
  3. In the Advanced tab, click Environment Variables at the bottom.
  4. Select the PATH variable under the System Variable section.
  5. Select Edit and click New.
  6. Add _;C:\Users\%username%\AppData\Local\Android\android-sdk\tools\;C:\Users\%username%\AppData\Local\Android\android-sdk\platform-tools_ if you didn’t change the location in the installation window. If you did change the location then update C:\Users\%username%\AppData\Local to the new location.

Note: Replace %username% with your account username.

Confirm the changes and you’re ready to use the SDK.

Linux

Download the .tgz file from the Linux section here.

After the download has finished, extract the contents into your Home directory.

Open your ~/.bashrc file or create it if it does not exist. This is a hidden file inside your Home directory. Enable View Menu -> Show hidden files in your file navigator or open from the command line.

Add these lines at the end of the file:

export ANDROID_HOME=/home/<yourusername>/Android/Sdk
export PATH=$PATH:/home/<yourusername>/Android/Sdk/tools

Replacing <yourusername> with your user name.

Save the file and restart your computer or log-out and log-in.

Mac

Download the .zip file from the Mac section here. Extract the android-sdk-macx86_ folder into your home directory for easy access.

Set the PATH variable in the .bashprofile_ file located in your home directory by adding the following lines:

export PATH=/Users/me/android-sdk-mac_86/platform-tools:/Users/me/android-sdk-mac_86/tools:$PATH

Replacing /Users/me with your user name.

Save and reboot your computer for the changes to take effect.

Homebrew

Another great option for Mac users is using Homebrew to install and keep the Android SDK up to date. Install with the standard brew command:

brew install android-sdk

That’s it, you are now ready to use the Android SDK. If you have any questions or comments, please let me know below.

No Reader comments

Recommended
Sponsors
Because We Like You
Free Ebooks!

Grab SitePoint's top 10 web dev and design ebooks, completely free!

Get the latest in Mobile, once a week, for free.