How to install and configure Gradle in windows,linux ?

This tutorial explains a step-by-step tutorial on how to install and set up the below environments.

  • windows
  • Linux
  • Mac OS

Gradle is a Java and Android project build automation tool.

More projects are adopting this tool during development now that Android Studio supports integration with Gradle.

Gradle requires Java to be installed. It needs JDK version 8 at least.

First, check whether Java is installed or not using the below command.

B:\>java -version
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)

You can also check install maven tutorial

Install Gradle tool on Linux machine

Unix has an SDKMAN online tool to manage different versions of packages.

It provides SDK commands to install.

On the shell or bash terminal, Run the below command.

SDK install Gradle 7.1.1

7.1.1 is the latest version, you can use a different version.

Configure environment variables like below

export PATH=$PATH:/tmp/Gradle/Gradle-7.1.1/bin

How to Setup Gradle tool in Mac OS?

Gradle installation was done with a homebrew tool.

It is simple and easy to do with the below command.

brew install gradle

How to install Gradle on windows

  • First, download the latest Gradle distribution file from gradle download🔗

  • Unzip to a local drive, d:\gradle

  • Create an environment variable in windows GRADLE_HOME=d:\gradle

  • Change or update the PATH environment variable to add Gradle home

PATH=%PATH%;%GRADLE_HOME%\bin
  • Open the terminal and you can able to run the Gradle command.

How to check whether Gradle is installed or not?


B:>gradle -v

------------------------------------------------------------
Gradle 6.0.1
------------------------------------------------------------

Build time:   2019-11-18 20:25:01 UTC
Revision:     fad121066a68c4701acd362daf4287a7c309a0f5

Kotlin:       1.3.50
Groovy:       2.5.8
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          1.8.0_102 (Oracle Corporation 25.102-b14)
OS:           Windows 10 10.0 amd64