Manually install Gradle and use it in Android Studio

后端 未结 17 2028
忘掉有多难
忘掉有多难 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

    0 讨论(0)
  • 2020-12-07 12:03

    Step 1: Go to the download site from Gradle: https://gradle.org/releases/

    Step 2: Extract the downloaded zip file into a directory.

    Step 2: Hit Ctrl + Alt + S (mac: ⌘ + ,) in Android studio/Intellij IDEA

    Step 3: Goto: Build, Execution, Deployment >> Build Tools >> Gradle (Or just type in the searchbar Gradle)

    Step 4: Select: (X) Use local gradle distribution and set Gradle home to your extracted Gradle directory. Click on apply.

    Step 5: Get rid of your unnecessary gradle files delete:
    - MyApp/gradle/
    - gradlew
    - gradlew.bat

    0 讨论(0)
  • 2020-12-07 12:05

    Unpack it where ever you like. In Android Studio under Settings is category Gradle where you can specify external gradle location if you want. It probably makes sense to put gradle bin folder into your path.

    0 讨论(0)
  • 2020-12-07 12:06

    Follow these steps

    1. Download gradle
    2. Extract the file to a specific location you desire
    3. Open android studio Click on setting and on build, execution and deployment, then gradle
    4. Enable work offline and change service directory to the location of the extracted filed.

    This is what worked for me. I hope it helps.

    0 讨论(0)
  • 2020-12-07 12:06

    in first step you should go to http://www.gradle.org/downloads and then choose your Gradle version and follow download link in GitHub and then download Gradle from GitHub. after your download is completed, you should extract the downloaded file in a directory (every directory that you want). finally open extracted folder and just run gradlew.bat and wait several minutes for completing download. and after completing download files, Gradle install itself automaticly. Gradle will work correctly for next times. i resolve this problem with this way and i tested it and every things are ok, so every one can test this way, it should working well. Good Luck.

    0 讨论(0)
  • 2020-12-07 12:07

    I used like this,

    distributionUrl=file\:///E\:/Android/Gradle/gradle-5.4.1-all.zip
    

    And its worked for me.

    0 讨论(0)
提交回复
热议问题