Maybe..your Gradle path is not set for globally.
Export Using this command... And source it.
wget https://services.gradle.org/distributions/gradle-5.2.1-bin.zip -P /tmp sudo unzip -d /opt/gradle /tmp/gradle-*.zip sudo vi /etc/profile.d/gradle.sh export GRADLE_HOME=/opt/gradle/gradle-5.2.1 export PATH=${GRADLE_HOME}/bin:${PATH} source /etc/profile.d/gradle.sh gradle -v