Manually configure gradle environment variables

If you want to manually execute the gradle script on the command line, and you encounter such an error when executing:
'gradle' is not an internal or external command, nor is it an executable program,
then you need to manually set the gradle environment variable, as follows:

1. Find the installation directory of gradle. Assuming that the user name for logging in to the current computer is chen, then the installation directory of gradle is in the following location:
C:\Users\chen\.gradle\wrapper\dists\
This directory stores the Android project All gradle versions are used in, there may be more than one subdirectory, choose a version you often use, for example, select: gradle-5.5-all. After entering the gradle-5.5-all directory, you will see irregularly named subdirectories. There may also be multiple subdirectories. Just choose one here. For example, select byeise1led9a3w3p149d02kfj. Then enter: gradle-5.5\bin, you will see a gradle file, which means the directory is right.
To sum up, the complete path we found in the end is as follows, copy it, and use it next.
C:\Users\chen\.gradle\wrapper\dists\gradle-5.5-all\byeise1led9a3w3p149d02kfj\gradle-5.5\bin

2. Configure environment variables.
Add the copied path to the Path variable of the environment variable, and click OK to save.

3. Verify that gradle is successfully configured.
Enter the following command in the newly opened command line to check the gradle version:
gradle -version
If the configured gradle version number is returned, the configuration is successful.
 

Guess you like

Origin blog.csdn.net/chenzhengfeng/article/details/108651931