How to Install JDK, Android SDK Tools, and Gradle on Linux for Mobile Development
This guide walks through downloading and extracting JDK 8, setting up Android SDK tools, installing Gradle, configuring environment variables, and using sdkmanager commands on a Linux system to prepare a complete mobile development environment.
1. Install JDK
Download JDK 8 from the Oracle website, extract it to /usr/local , and add the following environment variables to /etc/profile :
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
After obtaining the SDK tools zip (requires internet access), unzip it to /usr/local and configure the Android environment:
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 configuration
# 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/
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 Gradle binary distribution, unzip it to /usr/local , and set the Gradle environment variables:
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. Use sdkmanager
Common sdkmanager commands for listing, installing, and uninstalling packages:
sdkmanager --list # List installed and available packages
sdkmanager "platforms;android-28" # Install a specific platform package
sdkmanager --uninstall "platforms;android-28" # Remove a packageFAQ
If you encounter "GLIBC_2.14 not found", upgrade glibc following the linked guide: https://blog.csdn.net/dream_gf/article/details/81181388
For further assistance, follow the DevOps Cloud Classroom channel.
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.