Mobile Development 5 min read

Step-by-Step Guide to Installing JDK, Android SDK Tools, and Gradle on Linux

This tutorial explains how to download and install JDK 8, set up Android SDK tools, install Gradle, and configure environment variables on a Linux system, including verification commands and a brief FAQ for common issues.

DevOps Cloud Academy
DevOps Cloud Academy
DevOps Cloud Academy
Step-by-Step Guide to Installing JDK, Android SDK Tools, and Gradle on Linux

1. Install JDK

Download JDK 8 from the official Oracle website ( link ) and extract it to /usr/local . Then add the following lines to /etc/profile to set JAVA_HOME and update PATH :

tar zxf jdk-8u201-linux-x64.tar.gz -C /usr/local

# Add to /etc/profile
export JAVA_HOME=/usr/local/jdk1.8.0_201
export PATH=$PATH:$JAVA_HOME/bin

source /etc/profile

java -version

2. Install Android SDK Tools

Access the Android Studio download page (requires a proxy) at developer.android.com , download the SDK tools zip, and unzip it to /usr/local . After extraction a tools directory will be created.

unzip sdk-tools-linux-4333796.zip -d /usr/local

export ANDROID_HOME=/usr/local/
export PATH=$PATH:$ANDROID_HOME/tools/bin

source /etc/profile

sdkmanager --list  # Verify environment variables

# Example output (truncated)
[root@VM_7_14_centos ~]# sdkmanager --list | head -10
[======================Warning: File /root/.android/repositories.cfg could not be loaded.
Installed packages:=====================] 100% Computing updates...
  Path                 | Version | Description                    | Location
  -------              | ------- | -------                        | -------
  build-tools;20.0.0   | 20.0.0  | Android SDK Build-Tools 20     | build-tools/20.0.0/
  build-tools;23.0.1   | 23.0.1  | Android SDK Build-Tools 23.0.1 | build-tools/23.0.1/
  ...

3. Install Gradle

Download the latest Gradle binary distribution from gradle.org and unzip it to /usr/local . Then set GRADLE_HOME and update PATH :

unzip -d /usr/local gradle-5.3-bin.zip

export GRADLE_HOME=/usr/local/gradle-5.3
export PATH=$PATH:$GRADLE_HOME/bin

source /etc/profile

gradle -v

------------------------------------------------------------
Gradle 5.3
------------------------------------------------------------
Build time:   2019-03-20 11:03:29 UTC
Revision:     f5c64796748a98efdbf6f99f44b6afe08492c2a0
Kotlin:       1.3.21
Groovy:       2.5.4
Ant:          Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM:          1.8.0_201 (Oracle Corporation 25.201-b09)
OS:           Linux 2.6.32-696.el6.x86_64 amd64

4. SDKmanager Commands

sdkmanager --list                     # List installed and available packages
sdkmanager "platforms;android-28"    # Install a specific platform package
sdkmanager --uninstall "platforms;android-28"  # Uninstall the package

FAQ

If you encounter the error GLIBC_2.14' not found , you need to upgrade the glibc library. See the linked article for instructions. https://blog.csdn.net/dream_gf/article/details/81181388

SDKAndroidGradleLinuxJDKSetup
DevOps Cloud Academy
Written by

DevOps Cloud Academy

Exploring industry DevOps practices and technical expertise.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.