How to install the Android SDK on Windows, Mac and Linux

0
1500
How to Install SDK

What does Android SDK mean?

The Android SDK (software development kit) is a set of development tools which is used to develop applications for the Android platform. The Android SDK includes the following:

  • Required libraries
  • Debugger
  • An emulator
  • Relevant documentation meant for the Android application program Interfaces (APIs)
  • Sample source code
  • Tutorials for the Android OS

Every time Google releases another version of Android, a corresponding SDK is also released. To be able to write programs with the latest features, developers must download and install each version’s SDK for that particular phone.

The development platforms that are compatible with SDK include operating systems like Windows (XP or later), Linux (any recent Linux distribution) and Mac OS X (10.4.9 or later). The components of the Android SDK can be downloaded separately.

We also have Third party add-ons available for download.

However the SDK can be used to write Android programs in the command prompt, the most common technique is by using an integrated development environment (IDE). The most widely used and trusted IDE is Eclipse with the Android Development Tools (ADT) plug-in.

However, other IDEs, such as NetBeans or IntelliJ, can also work. Most of these IDEs provide a graphical interface which enables developers to perform development tasks quicker. Since Android applications are written in Java code, a user should have the Java Development Kit (JDK) installed.

How install Android SDK tools

The Android SDK (Software Development Kit) is a large and powerful tool that’s very important for Android app development. It serves several other purposes, too, such as using the command line to sideload apps onto your Android phone.

There are quite a few details and things to consider when installing the Android SDK on your PC. The following guide should help you wade through the process

If you installed the Android SDK some years ago, then you must have noticed a key difference when doing it today. The installation page no longer has a link to install the Eclipse ADT, which many developers used to build apps with.

That’s because Google is trying to garner people using its own Android Studio to develop apps instead, and to that end, Android Studio is more feature-complete with add-ons and plugins to help the users.

Prerequisites

For this, a working version of Java is required to run the SDK components. For most of the things, you’ll be doing with the SDK both Open Java and Sun Java from Oracle will work.

  • On a Mac, it’s comparatively easy because you’ll already have it installed unless you uninstalled it. If you have uninstalled it, install it again.
  • On Windows, go to  Oracle websiteand download the correct version (32- or 64-bit) for your computer. Again, if this causes you any trouble stop what you’re doing and delve 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 Java. You can find x86 and x64 binaries for Sun Java from Oracle at their website.

OpenJDK also works for most things you’ll need to do with the SDK.(OpenJDK is now stacked with Android Studio which includes the SDK as well as a development environment) and you can find complete instructions to get it installed at the OpenJDK website.

If you need more guidance or want to use a package manager to install Sun Java, you’ll need to refer to the documentation for your particular distro, and you need to delve further.

Linux users will also have to ensure that 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 another Debian variant, install ncurses5 and stdc++6 through your terminal:

sudo apt-get install lib32ncurses5 lib32stdc++6

If you’re using a different flavour of Linux, find the suitable packages for ncurses5 and stdc++6 and install them.

Installing the tools

Extract the file you downloaded above into a folder named Android on the root of your C drive (Windows) or into your Home folder (Mac, Linux).

You might notice that a few things are absent if you’ve ever downloaded the command line tools before as the tools and platform-tools folders are missing. That’s OK; we’re about to retrieve them using the included SDK manager.

Open the bin folder in the extracted download and find the SDK manager executable file. It may look like a terminal or shell command, but it will open a GUI as long as you have Java installed correctly.

Install Latest Version of Java
JAVA JSE

If you don’t want to use Android Studio and want the Android SDK command line version, then you’ll first need to download and install Java.

Pick the Windows “.exe” version from the list, then download and install it.

Install SDK Command Line

Android studio

Android Studio is a space-consuming app, and while we think its UI makes it a very accessible way of managing your development tools and packages, some people prefer the command-line route.

On the Android Studio download page, select one of the options under “Command line tools only.” Download it and install it to a folder called “Android” on the hard drive.

In the folder go to “tools/bin,” then right-click “SDK Manager” and run as administrator.

This must install the necessary packages and leaves us with a command line prompt where you can enter various commands to manage the SDK tools.

For us, a good place to start is getting the platform tools by typing:

SDK manager “platform-tools””platforms;android-28”

sdk manager

This will give you access to the ADB and fast boot commands, which are great if you prefer side loading things onto Android and dabbling in the recovery options.

Install Android Studio

If you want to cherish all the modern features, conveniences and UI elements of Android Studio, then it’s pretty simple. On the Android Studio download page select “Download Android Studio,” and follow the instructions. During installation, however, there are a couple of things to be noted.

If you want even more control over which components of Android Studio to install, click “Custom” when the installer gives displays the option.

This is where you can select extra features to download like Android Virtual Device, which creates an emulated environment to test numerous features and apps in, the Intel HAXM hardware accelerator for the emulator (recommended for powerful PCs), and the API libraries for developing apps on the latest version of Android.

SDK Component setup

On the next page, you can increase the amount of RAM dedicated to hardware-accelerating the Android emulator. If you have RAM to spare (16GB perhaps), then you can comfortably move this slider higher than the recommended amount.

SDK Componenet1

Once you go through all these settings, Android Studio will begin installing. It’s a big program so it may take a while.

SDK Manager and the Virtual Device Manager

Once Android Studio is installed, open it to be greeted with a menu inviting you to start working on a project. You can also click the “Configure” button at the bottom-right corner of the window, which will let you go into a nice GUI version of the SDK Manager and the Virtual Device Manager, among other things.

Component

These are the basics that should get you going with the Android Software Development Kit.

After installing android studio, still, there is a need to configure some Android SDK environment variables then you can use it easily. This article will tell you how to correctly configure SDK environment variable such as ANDROID_HOME, PATH etc.

We know that a lot of people are reluctant to make the jump over to Android Studio, but from what we’ve seen of it, it’s thoughtfully designed and makes app project management look pretty smooth. For developers who’re dabbled with Android Studio. What do you think of it? Let us know!

Manually installing the Android SDK

Download the SDK directly from Google by clicking here. Scroll down a little and find the section labelled “Get just the command line tools” and save it at an easily accessible place, like your desktop.

We’ll be extracting it to a better location in the next step.

The file you downloaded is presently compressed. You’ll have to be familiar with compressed files and how to extract them in order to go any further. If you’re not, take a halt 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 the guide, and your time with the SDK, much easier.

In the SDK manager, you have to choose to install Android SDK Tools and Android SDK Platform-Tools.

In case you’re using Windows you’ll also want to install the Google USB Driver, and if you are planning on building AOSP from source, you will have to install the Android SDK Build-Tools.

Choose the suitable files and proceed through the stated process (it will show you a license agreement you must read) and both the tools folders will be installed. But you’re not finished as yet !

The tools will be installed into the application data folder. On Windows it’s in Windows\users\YourUserName\AppData\Local\Android and on a Mac or Linux it’s in.Android (mind the dot!) in your home folder. Create a symbolic link (information for Windows users here) for both tools folders in the Android folder which you had created earlier. This will help fetch them into your PATH and make computing a lot easier.

Setting your PATH

Setting path

The PATH variable in your computer’s operating system will tell 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 will either need to type and provide the complete path — i.e. the folder ADB is actually in, inside the SDK folder — or have the location set in the PATH variable itself. It’s a little confusing, but the good news is that doing it is easier than explaining it.

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

On Windows

Just unless you’re still using an older version of 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. Below is stated how it’s done on a Windows 10 machine:

  • Press the Start key on your Keyboard.
  • Start typing in 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 User variables for (your user name) section, then select the Edit

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

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

In case you have 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 elsewhere than \Android, you’ll need to adjust accordingly.

On a Mac
MAC SDK

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 must not touch the .bashrc or .bash_profile files you might find in the /etc directory!

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

export PATH=”$HOME/Android/tools:$PATH”

export PATH=”$HOME/Android/platform-tools:$PATH”

Note that if your SDK is in another location, you’ll need to adjust things accordingly

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

On Linux

Setting the PATH on a Linux computer is more or less 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 need to add the following two lines to the END of the .bashrc file:

export PATH=”$HOME/Android/tools:$PATH”

export PATH=”$HOME/Android/platform-tools:$PATH”

Save the file, and close the terminal window. Open a new instance of the terminal and type the given command:

source ~/.bashrc

Your session will reference the changes you’ve made and the SDK will be in your PATH.

Concluding, you should now have a working set of Android command line tools and must be able to do things like flash the latest factory images or manually update your phone with a zip file. Now that you’ve fixed it yourself, you know what to do when things go wrong.

Hope you could follow our tutorial. Enjoy Android SDK environment.

LEAVE A REPLY

Please enter your comment!
Please enter your name here