Your cart is currently empty!
How to install Gradle on Ubuntu
Gradle is a powerful build automation tool used for Java, Kotlin, and other JVM languages. Whether you’re building Android apps or Java libraries, Gradle is often the go-to. Here’s how to install it cleanly on Ubuntu.
✅ Prerequisites
Make sure you have:
- A system running Ubuntu 18.04 or newer
- sudo access
- Java installed (Gradle needs it)
You can check if Java is installed:
java -version
If it’s not, install it:
sudo apt update
sudo apt install openjdk-17-jdk -y
🔧 Step 1: Download the Latest Gradle Release
First, check the Gradle releases page for the latest version. At the time of writing, it’s 8.5.
Then, download and extract it:
wget https://services.gradle.org/distributions/gradle-8.5-bin.zip -P /tmp
sudo unzip -d /opt/gradle /tmp/gradle-8.5-bin.zip
This installs Gradle under /opt/gradle
.
⚙️ Step 2: Set Up Environment Variables
Create a new file to load Gradle into your shell:
sudo nano /etc/profile.d/gradle.sh
Paste this in:
export GRADLE_HOME=/opt/gradle/gradle-8.5
export PATH=${GRADLE_HOME}/bin:${PATH}
Save and exit. Then apply the changes:
sudo chmod +x /etc/profile.d/gradle.sh
source /etc/profile.d/gradle.sh
✅ Step 3: Verify the Installation
Run:
gradle -v
You should see version info and system environment details. That means it worked.
🚀 You’re Done
Gradle is now installed and ready to go. From here, you can create a new project or import one that uses a build.gradle
file. Simple.
Need a quick Gradle init?
gradle init
It’ll guide you through setting up a basic project.
Let me know in the comments if you hit any snags, or want help setting up your first Gradle build.