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.
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.
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.
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
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.
- Open Control Panel
- Click System and on the left hand side select, Advanced system settings.
- In the Advanced tab, click Environment Variables at the bottom.
- Select the PATH variable under the System Variable section.
- Select Edit and click New.
- 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.
%username% with your account username.
Confirm the changes and you’re ready to use the SDK.
Download the .tgz file from the Linux section here.
After the download has finished, extract the contents into your Home directory.
~/.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
<yourusername> with your user name.
Save the file and restart your computer or log-out and log-in.
Download the .zip file from the Mac section here. Extract the android-sdk-macx86_ folder into your home directory for easy access.
PATH variable in the .bashprofile_ file located in your home directory by adding the following lines:
/Users/me with your user name.
Save and reboot your computer for the changes to take effect.
Another great option for Mac users is using Homebrew to install and keep the Android SDK up to date. Install with the standard
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.