文章目錄
- 一、下載 Gradle 工具
- 二、查找本地快取的 Gradle 工具
- 三、配置 Gradle 環境變數
一、下載 Gradle 工具
到 Gradle 官方網站 https://gradle.org/ 下載 Gradle 工具 ;
- Gradle 安裝 : https://gradle.org/install/
- Gradle 版本 : https://gradle.org/releases/
二、查找本地快取的 Gradle 工具
也可以到 C:\Users\octop.gradle\wrapper\dists 目錄中查看 , 是否有 Gradle 快取 , 一般情況下 , 在 Android Studio 中配置使用過的 Gradle 版本 , 都快取在這里 , 這是由 gradlew 命令列工具自動配置安裝在這里的 ;

進入到 C:\Users\octop.gradle\wrapper\dists\gradle-6.7.1-bin\bwlcbys1h7rz3272sye1xwiv6\gradle-6.7.1 目錄中 , 確認該版本的 Gradle 是完整的即可 ;

雖然電腦上已有 Gradle 版本 , 但是此時在命令列中運行
gradle
命令 , 還是會提示
'gradle' 不是內部或外部命令,也不是可運行的程式
或批處理檔案,
需要將 Gradle 下的 bin 目錄配置到環境變數中 ;

三、配置 Gradle 環境變數
首先獲取到 Gradle 工具的 bin 目錄
C:\Users\octop\.gradle\wrapper\dists\gradle-6.7.1-bin\bwlcbys1h7rz3272sye1xwiv6\gradle-6.7.1\bin

將該目錄配置到環境變數中 ;

然后 , 在命令列中執行
gradle
命令 , 發現執行成功 ;
C:\Users\octop>gradle
Welcome to Gradle 6.7.1!
Here are the highlights of this release:
- File system watching is ready for production use
- Declare the version of Java your build requires
- Java 15 support
For more details see https://docs.gradle.org/6.7.1/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :help
Welcome to Gradle 6.7.1.
To run a build, run gradle <task> ...
To see a list of available tasks, run gradle tasks
To see a list of command-line options, run gradle --help
To see more detail about a task, run gradle help --task <task>
For troubleshooting, visit https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 5s
1 actionable task: 1 executed
C:\Users\octop>

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/384221.html
標籤:其他
上一篇:Postman的pm物件(三)
