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.
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 -version2. 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 amd644. 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 packageFAQ
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
DevOps Cloud Academy
Exploring industry DevOps practices and technical expertise.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.