Manually install Gradle and use it in Android Studio

后端 未结 17 2089
忘掉有多难
忘掉有多难 2020-12-07 11:35

I\'m using Android Studio. How can I manually install and use Gradle within Android Studio.

I\'ve downloaded Gradle from http

17条回答
  •  甜味超标
    2020-12-07 12:00

    I'm not sure why there are so many contorted descriptions of doing this. Perhaps because Android Studio (AS) is constantly changing/evolving? Nevertheless, the procedure is this simple.

    Assuming you have already installed Gradle in a suitable directory, mean that you probably also defined an environment variable for GRADLE_HOME, if not define it now, and restart AS.

    For my example: GRADLE_HOME=C:\Gradle\gradle-5.2.1

    Then fire up AS and navigate to:
    File > Settings > Build, Execution, Deployment > Gradle

    Now, all you need to do is to select: (o) Use local gradle distribution. AS will then tell you it found your local Gradle paths:

    Hit Apply and Ok and restart AS.

    Now all the Gradle data can be found in your HOME directory, usually located here (in this case on Windows):

    # tree -L 2 $USERPROFILE/.gradle/ | tail -n +2
    
    ├── build-scan-data
    │   ├── 2.1
    │   └── 2.2.1
    ├── caches
    │   ├── 3.5
    │   ├── 5.2.1
    │   ├── jars-3
    │   ├── journal-1
    │   ├── modules-2
    │   ├── transforms-1
    │   ├── transforms-2
    │   ├── user-id.txt
    │   └── user-id.txt.lock
    ├── daemon
    │   ├── 3.5
    │   └── 5.2.1
    ├── native
    │   ├── 25
    │   ├── 28
    │   └── jansi
    ├── notifications
    │   └── 5.2.1
    ├── workers
    └── wrapper
        └── dists
    

    Tested on latest AS 3.3.2

提交回复
热议问题