Mobile Development 4 min read

How to Install JDK, Android SDK Tools, and Gradle on Linux

This guide explains how to install JDK 8, Android SDK Tools, and Gradle on a Linux system, including downloading packages, extracting them, configuring environment variables, verifying installations, and using sdkmanager to list, install, or uninstall Android platform packages.

DevOps Cloud Academy
DevOps Cloud Academy
DevOps Cloud Academy
How to Install JDK, Android SDK Tools, and Gradle on Linux

1. Install JDK

Download JDK 8 from the Oracle website (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) and extract it:

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

Download the SDK Tools zip (requires VPN) from the Android developer site and unzip it:

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 snippet
[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/
... (additional entries omitted)

3. Install Gradle

Download Gradle from https://gradle.org/gradle-download/ and unzip it:

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. Use sdkmanager

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

FAQ

GLIBC_2.14 not found – upgrade glibc. See: https://blog.csdn.net/dream_gf/article/details/81181388

Mobile DevelopmentGradleLinuxJDKAndroid SDKSetup
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.