Android SDK (Command Line) Installation for Windows

Android SDK (Command Line) Installation for Windows

📥 Downloading Command Line Tools

You need to click here and download the latest version of the Android SDK. Click the link, scroll down, and download the latest version of the command line tools for Windows on your system from the command line tools section.

Platform SDK tools package Size SHA-256 checksum
Windows commandlinetools-win-13114758_latest.zip 143.0 MB 98b565cb657b012dae6794cefc0f66ae1efb4690c699b78a614b4a6a3505b003

You will see a table like the one above, you need to download the command line tools from there. While downloading, it will ask you to agree to an EULA (Terms of Use Policy); you must accept this to be able to download. After the approval, a zip file named "commandlinetools-win-xxx_latest.zip" will be downloaded to your system.

🏗️ Installing Command Line Tools

Let's extract the downloaded zip file to a location that is easy to access.

Example file location:

C:\Android\cmdline-tools\

When we extract the zip to the folder above, there should be a folder called "latest" inside it. This "latest" folder should contain folders and files such as "bin".

If your zip file does not contain a "latest" folder, create a folder named "latest" yourself and move the extracted files there. After this process, your example file path should be as follows:

C:\Android\cmdline-tools\latest

When we check the file content, we should see paths similar to the following inside the file.

C:\Android\cmdline-tools\latest\bin\...

If you see a path similar to the one above, it means you have completed this part correctly.

⚙️ Setting Environment Variables

🛠️ Creating a System Variable

We create a new system variable.

Variable Name: ANDROID_HOME
Variable Value: C:\Android

The variable value here must be the location where you installed the command line tools.

📌 PATH Settings

After creating the system variable, we need to add our variables to the PATH in order for it to work.

%ANDROID_HOME%\cmdline-tools\latest\bin
%ANDROID_HOME%\platform-tools

NOTE: The Platform Tools folder does not exist yet, but we will install the platform tools using the command line tools via CMD.

Note2: If you are using tools like Flutter, React Native, Gradle, Expo, include the components you have installed in the environment variables at the end of the Install SDK Components step.

%ANDROID_HOME%\platform-tools
%ANDROID_HOME%\emulator
%ANDROID_HOME%\cmdline-tools\latest\bin
%ANDROID_HOME%\build-tools\34.0.0

The example above is given for reference; adjust those containing versions according to the version of the component you have installed.

📦 Installing SDK Components

sdkmanager --list

Use the command above to check if the SDK Manager is working. If the SDK Manager is working, install the necessary components with the following command.

sdkmanager "platform-tools" "platforms;android-33" "build-tools;33.0.2" "emulator"

Note: Update/modify the components listed here according to your needs.

adb version

Use the command above to test if the components have been installed, if the output of the above command is something like "Android Debug Bridge version ..." the installation is complete.

✅ Open JDK

For the command tool to work, JDK needs to be installed on your system.

💾 Download Process

Click here to download Open JDK. As of the writing of this article, JDK 17 is commonly used, but this may change in the future.

Select the Windows version on the page, download it to your system, and complete the installation by clicking next.

Note: During the next steps, it will ask if you want to set the environment variable. You can let it set the environment variable automatically there.

Once the installation is complete, Open JDK will be installed in a location like below.

C:\Program Files\Eclipse Adoptium\jdk-17.x.x

If you did not set the environment variable automatically as mentioned in the "Note" section above, you will need to set it manually.

🛠️ Setting the Manual Environment Variable

Variable Name: JAVA_HOME
Variable Value: C:\Program Files\Eclipse Adoptium\jdk-17.x.x

After creating the above system variable, add the following to "PATH"

%JAVA_HOME%\bin

You need to add the command above.

🧃✅ JDK Check Process

After the Open JDK installation is complete, check it by entering the commands below in the terminal. Before checking, close any open terminals and then try again.

java -version
javac -version
echo %JAVA_HOME%

The output should look like this.

openjdk version "17.0.x"  Temurin

If you get an output like above, it means JDK has been successfully installed on your system.