Mac gradle configuration

Posted May 27, 20201 min read

1. Configure Java environment

Ensure that the Java environment is installed, the JDK version is greater than 1.6, configure the environment variable JAVA \ _HOME, check the Java version can be entered in the terminal

java -version

2 . Download Gradle
Gradle download address
https://services.gradle.org/distributions/

Download the latest version:gradle-6.0(the latest version on November 8, 2019), remember to download the all version, which contains all relevant content of the Gradle SDK, including source code, documentation, examples, etc.

3 . Unzip to local path
/Applications/Android Studio.app/Contents/gradle/gradle-4.4

4 . Configure to environment variables

export GRADLE_HOME =/Applications/Android \ Studio.app/Contents/gradle/gradle-4.4
export PATH = ${PATH}:${GRADLE_HOME}/bin
export PATH = "$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"

Update update.bash \ _profile

source ~/.bash_profile

5 . Check if the configuration is successful
Run gradle -version on the terminal to check whether the configuration is successful. As shown below, the configuration is successful.

-------------------------------------------------- ----------
Gradle 4.4
-------------------------------------------------- ----------

Build time:2017-12-06 09:05:06 UTC
Revision:cf7821a6f79f8e2a598df21780e3ff7ce8db2b82

Groovy:2.4.12
Ant:Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM:1.8.0_101(Oracle Corporation 25.101-b13)
OS:Mac OS X 10.14.5 x86_64