Android SDK

Everything you need to get started with the Android SDK, and everything you need to know about installing it

Installing the Android SDK is far easier than it used to be, thanks to a new package from Google. One download not only gives you a complete and working Android SDK, but it also has everything you would need to develop application in Eclipse should you ever want to dabble in it. That's not required, though, and for anyone looking for an easy way to begin using tools like adb, it's the best way to get started.

For sure, this is not the only way. All the tools are still there for an install without any IDE bundled in, and if you're an advanced user you'll probably want to go that route. This little tutorial wasn't written with you in mind, it's geared towards users who are computer-literate but haven't yet dipped into the world of Android from the command line.

Let's begin.

Getting started with the Android SDK

Android files

I told you this was pretty easy, and that there was just one file to download. Here it is. Download the SDK direct from Google by clicking here. The page should detect whether you're running Windows, Mac OS or Linux and serve up the appropriate file. Save it somewhere easy to get to, like your desktop. We'll be extracting it to a better location in the next step.

The file you downloaded is compressed. You'll need to be familiar with compressed files — and extracting them — to go any further. If you're not, stop here and spend the time to learn about them.

Extract your compressed file into the following location:

  • Windows: The root of your C: drive
  • OS X: Your home folder
  • Linux: Your home folder

Rename the extracted folder to "Android". This will make the rest of this guide, and your time with the SDK, much easier.

Inside the folder you just renamed you should see two other folders, named eclipse and sdk respectively. If you don't, make sure you downloaded the right file and extracted it correctly. If you see those folders, congrats — you've successfully installed the Android SDK. Now let's get it running.

Prerequisites

Java

You'll need a working version of Sun Java to run the SDK components. Advanced users may try alternatives like Open Java, but for this guide we're sticking with the official Sun Java from Oracle. Yes, that Oracle.

On a Mac, it's pretty easy because you'll already have it installed unless you uninstalled it. If you did, install it again — you should know how.

On Windows, head to the Oracle website and download the correct version (32- or 64-bit) for your computer. Again, if this gives you any trouble stop what you're doing and learn a bit more about your computer. If you can't install Java, maybe you're not yet ready to use the Android SDK.

On a Linux computer, you'll also need to install Sun Java from Oracle. You can find x86 and x64 binaries at the Java website. If you need more assistance, or want to use a package manager to install Java, you'll need to refer to the documentation for your particular distro.

Linux users will also have to make sure they have some 32-bit libraries installed if they are running a 64-bit version of the operating system. If you're using Ubuntu or an other Debian variant, install ncurses5 and stdc++6 through your terminal:

sudo apt-get install lib32ncurses5 lib32stdc++6

Packages for other distros, like SlackWare or Fedora should be available as well. See the documentation for your particular distro.

Setting your PATH

Windows 8 PATH

The PATH variable in your computer's operating system tells it where to look when you want to run a command from a terminal or the command line. For example, to run the adb command you either need to type and provide the complete path — ie the folder adb is actually in, inside the SDK folder — or have the location set in the PATH variable itself. It's a bit confusing, but the good news is that doing it is easier than explaining it.

For these directions to work, you will have to have extracted and renamed the SDK download folder as mentioned above, and to the correct location for this tutorial.

Windows

You no longer can set the PATH in the autoexec.bat file or autoexec.nt file. You'll need to update the system Environment Variable settings instead. Here's how it's done on a Windows 8 machine:

  • Hit the Start key on your Keyboard.
  • Start typing the words Environment Variables.
  • As you type, you'll see the choice to Edit the system environment variables. Choose it.
  • In the Environment Variables window, select the PATH line item in the Systems Variables section, then click the Edit button.

Add the full path to the Android SDK tools and Android SDK platform-tools folders in the edit box, separated by a semi-colon. It should look something like this:

C:\Android\sdk\tools;C:\Android\sdk\platform-tools

For older versions of Windows, refer to the documentation that came with your computer for assistance on setting the PATH. And, again: If you've installed your sdk somewhere other than \Android, you'll need to adjust accordingly.

OS X

You can set your PATH variable on a machine running OS X in your bash profile. Doing so is easy, and is all done in one file.

In your Home folder is a file named .bash_profile. Open it with any text editor.

You may see a blank file, or it may be full of other information. All we need to do is add a couple lines to the top of the file:

export PATH="$HOME/Android/sdk/tools:$PATH"
export PATH="$HOME/Android/sdk/platform-tools:$PATH"

(Did we mention that if your SDK is in another location, you'll need to adjust things accordingly? Good.)

Save the file, and reboot your computer so the new PATH is sourced properly.

Linux

Setting the PATH on a Linux computer is almost the same as on a Mac, you just edit a different file.

Using your favorite text editor, open the ~/.bashrc file. It will probably exist and have multiple entries. If you get an error that the file does not exist, simply create a new file and save it as ~/.bashrc when finished.

You'll want to add the following two lines to the END of the .bashrc file:

export PATH="$HOME/Android/sdk/tools:$PATH"
export PATH="$HOME/Android/sdk/platform-tools:$PATH"

Save the file, and reboot your computer so the new PATH is sourced properly.

Wrapping it up

Using adb

If you made it this far, you have successfully installed the Android SDK and can now use tools like adb and fastboot. Pat yourself on the back and have a frosty beverage. We're going to talk a lot more about how to use these tools in future articles, as well as making sure your phone is ready to go and connected.

If you can't wait to learn about drivers, and development tools, head into the Android Central forums to talk to some gurus and get a jump start.

Your Android is your oyster, and you'll need no sword to open it.

 
There are 16 comments

Reader comments

Installing the Android SDK for Windows, Mac and Linux: A tutorial

16 Comments
Sort by Rating

Thanks a lot, was reading through a lot of pages and was kinda lost, this came right on time!

Posted via my LG G Flex

Can you make a similar article about what is each of the components offered there, and where are their documentations?

Lol I remember the old SDK around Gingerbread was kind of a pain to install I already have the SDK but great guide Jerry

Sent from my Nexus 7 2013 or iPhone 5

I think opening an oyster is much easier than opening up your android. But I love the challenges it brings and the things you can do with it. Still debating on if I want to delve deeper into my new One.

This comes 5 days too late :( struggled for hours last week to get this running on my Fedora 20. Thanks anyway Jerry :D

A few things:

* Many computers already have "Sun Java from Oracle" (https://www.java.com/en/download/) installed for web apps. This posting should point out that they need the JDK (Java Development Kit); the JRE (Java Runtime Edition) is not enough. Partial credit for having the hyperlinks go to the right place.

* For the PATH for Windows, it ought to go in the User section, unless every user on that computer is expected to use it. The user PATH is automatically appended to the system PATH, so no need to reproduce the system PATH. You advocate path appending via user variable for OS X and Linux; putting it in system reduces security. Windows force of habit? :)

* One should similarly set JAVA_HOME in the user environment.

(Ten days late for me, fresh in mind.)

Thanks Jerry! As usual I'm late to the party! Just wanted to add a couple things after seeing this when clearing out some feeds. If you're running a 64 bit version of windows you can install whatever version of the SDK and JDK you want (x64 or x86) as long as the SDK and JDK are both the same. I'm using the 32 bit version of both on W7 Home Premium x64. When installing the JDK I chose 'not' to install the JRE with it because I don't want to have to hunt down the browser plugin and kick it to the curb not that it's a big deal to do so. I do not have the JRE on my system. Recently did a clean install of W7 x64 on a new hard drive then flashed the system and boot images on my N5 so I can confirm it works. Why the 32 bit version of both? No reason other than I knew I could from past experience! ;)

@LocationDudeNYC: Look for a file called ".bashrc" or ".profile" - add the changes there instead - whichever one exists or already has PATH info in it.