在學習andorid studio時發現編譯超級無比的慢,網上有文說是因為gradle的原因,使用離線gradle可以大幅提高編譯速度,准備嘗試下看看如何。由於gradle的資料都是英文,而我又是英文盲,所以嘗試翻譯下安裝過程並做個記錄。
原文如下:
Install manually
Step 1. Download the latest Gradle distribution
The current Gradle release is version 4.10.2, released on 19 Sep 2018. The distribution zip file comes in two flavors:
- Binary-only
- Complete, with docs and sources
If in doubt, choose the binary-only version and browse docs and sources online.
Need to work with an older version? See the releases page.
Step 2. Unpack the distribution
Linux & MacOS users
Unzip the distribution zip file in the directory of your choosing, e.g.:
$ mkdir /opt/gradle
$ unzip -d /opt/gradle gradle-4.10.2-bin.zip
$ ls /opt/gradle/gradle-4.10.2
LICENSE NOTICE bin getting-started.html init.d lib media
Microsoft Windows users
Create a new directory C:\Gradle
with File Explorer.
Open a second File Explorer window and go to the directory where the Gradle distribution was downloaded. Double-click the ZIP archive to expose the content. Drag the content folder gradle-4.10.2
to your newly created C:\Gradle
folder.
Alternatively you can unpack the Gradle distribution ZIP into C:\Gradle
using an archiver tool of your choice.
Step 3. Configure your system environment
Linux & MacOS users
Configure your PATH
environment variable to include the bin
directory of the unzipped distribution, e.g.:
$ export PATH=$PATH:/opt/gradle/gradle-4.10.2/bin
Microsoft Windows users
In File Explorer right-click on the This PC
(or Computer
) icon, then click Properties
-> Advanced System Settings
-> Environmental Variables
.
Under System Variables
select Path
, then click Edit
. Add an entry for C:\Gradle\gradle-4.10.2\bin
. Click OK to save.
Step 4. Verify your installation
Open a console (or a Windows command prompt) and run gradle -v
to run gradle and display the version, e.g.:
$ gradle -v
------------------------------------------------------------
Gradle 4.10.2
------------------------------------------------------------
› Proceed to next steps
中文安裝過程:
手動安裝:
1、下載最新的gradle安裝包,gradle-4.10.2-bin.zip
2、gradle當前最新版本是4.10.2,發布於2018年9月19日,有兩種發布形式,一種是僅有編譯過的可執行程序,一種是源代碼和幫助文檔,我們選擇二進制模式
3、解壓下載的文件到C:\Gradle(別的文件夾應該也可以)
4、設置系統環境變量,把C:\Gradle\gradle-4.10.2\bin路徑添加到path里面
5、檢查安裝是否成功,打開CMD,輸入gradle -v看看是否成功