Explains all the steps required to install Android SDK Tools on Windows without using Android Studio.

How To Install Android SDK Tools On Windows
How To Install Android SDK Tools On Windows
March 10, 2019

In this post, we will discuss the steps required to install Android SDK Tools on Windows. It assumes that JDK 8 or lower is installed on the system to work out of the box since JDK 9, 10, 11, and 12 have reported compatibility issues with Android SDK. There are solutions suggested by the community to work with JDK 9 and 10 as shown at the end of this post. Android SDK won't work with JDK 11 and 12 due to the removal of modules required by it. This tutorial provides the steps for Android SDK Tools on Windows 10, though the steps should be the same on other versions of Windows.

This post is useful for the developers using Android SDK Tools with other IDEs without installing Android Studio for the use cases including hybrid app development using Ionic. It also assumes that a valid JAVA_HOME environment variable exists pointing to the installation directory of Java.

You can follow How To Install Java 8 On Windows 10 to install Java 8 on Windows. In case you are interested in developing Android applications using Android Studio, you can also follow How To Install Android Studio On Windows.

Download SDK Tools

Open the download tab of Android Studio and scroll down to the Command line tools only section. This section shows various options to download the SDK tools as shown in Fig 1.

Download Android SDK Tools

Fig 1

Click on the first link having the download option for Windows. It will ask to accept to terms and conditions as shown in Fig 2.

Terms and Conditions

Fig 2

Go through the details, agree on the terms and conditions and click on the Download Button to start the download.

Install SDK Tools

In this step, we will install the Android SDK Tools on Windows. Create a directory having name set to android-sdk and extract the content of the downloaded SDK Tools zip to this directory. Make sure that the extracted content is available within the android-sdk directory created by us.

Install Platform Tools

In this step, we will install the Android Platform Tools on Windows. Follow the same steps similar to Android SDK Tools to install Android Platform Tools using the download link.

Android SDK Directory

Configure Environment Variable

Right-click on the My Computer on the desktop and click on the Properties option. Click on Advanced system settings. It will show the System Properties dialog having Advanced Tab options as shown in Fig 3.

Advanced System Settings

Fig 3

Click on Environment Variables Button and click on New Button in the first section. Set the Variable Name field to ANDROID_HOME and Variable Value to the android-sdk directory created by us in the previous step.

Similarly, also configure the environment variable ANDROID_SDK_ROOT to the android-sdk directory.

Also, make sure that the JAVA_HOME environment variable is set to the JDK installation directory. It must not end with the bin as we do with the system path variable.

Configure Commands

In previous steps, we have downloaded and extracted the SDK Tools and Platform Tools to the android-sdk directory. Both the tools provide several command-line utilities which we need to run by going to the appropriate directory having the executable files.

We can make these commands available at the system level without going to these directories by adding the path to tools, tools\bin, and platform-tools to system path as shown in Fig 4. Make sure that these executables do not break other commands having the same name before adding these paths to the PATH environment variable.

System Path

Fig 4

Now restart the system to apply the environment variables set by us.

# Check adb version
adb --version

# It must show the installed adb version
Android Debug Bridge version 1.0.40
Version 4986621
Installed as <path to android-sdk>\platform-tools\adb.exe

# Check sdkmanager version
sdkmanager --version

# It must shown installed sdkmanager version

Using the SDK Manager

List - We can list the installed and available packages and images using the list command as shown below.

// List all the installed and available platforms, system images and other resources 
sdkmanager --list

// Output should look like
Installed packages:=====================] 100% Computing updates...
Path | Version | Description | Location
------- | ------- | ------- | -------
platform-tools | 28.0.3 | Android SDK Platform-Tools 28.0.3 | platform-tools\
tools | 26.1.1 | Android SDK Tools 26.1.1 | tools\

Available Packages:

// We can see that it shows the tools and platform-tools installed by us

Install Platform - Use the below-mentioned command to install the Android 9 (API level 28) using the SDK manager.

# Go to the SDK Tools bin directory to access sdkmanager
# Start download the most recent package
sdkmanager "platforms;android-28"

It will ask to accept the terms and conditions. Enter y and hit Enter Key to accept the terms and conditions. This command creates the directory platforms within android-sdk and installs the package android-28 having all the required files to run the emulator for Android 9.

If we again check the installed packages, the list command shows the installed options as shown below.

sdkmanager --list
Installed packages:=====================] 100% Computing updates...
Path | Version | Description | Location
------- | ------- | ------- | -------
platform-tools | 28.0.1 | Android SDK Platform-Tools 28.0.1 | platform-tools\
platforms;android-28 | 6 | Android SDK Platform 28 | platforms\android-28\
tools | 26.1.1 | Android SDK Tools 26.1.1 | tools\

Available Packages:

Update SDK Manager - Update the SDK manager using the below-mentioned command.

sdkmanager --update

Add System Image - We can add system image from available images shown by list command using the SDK manager as shown below. We are adding the most recent default 64-bit system image.

// Install default system image for platform android-28
sdkmanager "system-images;android-28;default;x86_64"

Accept the License Agreement to complete the download.

There are several projects which need Google Play Services. We need system images specific to Google Play Services as shown below.

// Install Google Play Services system image
sdkmanager "system-images;android-28;google_apis_playstore;x86_64"

Install Emulator - We need to install the emulator before creating the AVD using SDK Manager.

// Install Emulator
sdkmanager --channel=3 emulator

Install Build Tools - Install the most recent build tool listed by the list command.

// Install Build Tools
sdkmanager "<build tools version>"

// Example
sdkmanager "build-tools;28.0.3"

Using the Emulator and AVD Manager

Create Android Emulator - Create the emulator using the system image downloaded in the previous step as shown below. Replace <emulator name> with actual name.

// Create the emulator using default system image
avdmanager create avd -n <emulator name> -k "system-images;android-28;default;x86_64" -g "default"

// Create emulator using Google Play Services system image
avdmanager create avd -n <emulator name> -k "system-images;android-28;google_apis_playstore;x86_64"

The above commands ask a bunch of questions to configure the AVD if we choose the custom hardware profile option. We have excluded the details of these options from this tutorial since these configuration details depend on the actual needs. After completing all the configurations, it creates the AVD using the name provided by us while configuring it.

List Android Emulators - Now go to the tools directory on the command line and check the installed platform as shown below.

// List the available emulators
emulator -list-avds

It will list all the AVDs installed by us.

Run Emulator - We can run the emulator created by us as shown below.

// Run Emulator
emulator -avd <emulator name>

The above command might show an error specific to the qt library. We can execute the emulator from the Android SDK Tools directory in such a case.

The emulator will take some time to completely launch the AVD. The final results should look similar to the one shown in Fig 5.

Android Emulator

Fig 5

Delete Emulator - We can also delete an existing emulator as shown below.

// Delete Emulator
avdmanager delete avd -n <emulator name>

Working with JDK 9 and 10

Use the below-mentioned command for JDK 9 and 10 on Linux and Windows.

// Linux/Mac
export JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'

// Windows
set JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'

Modifying the SDK manager script is another option as shown below.

// Replace this

// With
DEFAULT_JVM_OPTS='"-Dcom.android.sdklib.toolsdir=$APP_HOME" -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'

We need to download additional jars(JAXB, JAF) and modify the SDK manager script - sdkmanager.bat for Java 11 as shown below.

set CLASSPATH=jaxb-core.jar;jaxb-impl.jar;jaxb-api.jar;activation.jar

Write a Comment

Click on the captcha image to get new code.
Discussion Forum by DISQUS