Manually install Gradle and use it in Android Stud

2019-01-16 11:31发布

问题:

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

I've downloaded Gradle from http://www.gradle.org/downloads version gradle-2.1-all.zip.

When I open the zipped file I can see bin, docs etc, but I don't know where to copy it. And even after copying how to use it within Android..

回答1:

Android Studio will automatically use the Gradle wrapper and pull the correct version of Gradle rather than use a locally installed version. If you wish to use a new version of Gradle, you can change the version used by studio. Beneath your Android Studio's project tree, open the file gradle/wrapper/gradle-wrapper.properties. Change this entry:

distributionUrl=http\://services.gradle.org/distributions/gradle-2.1-all.zip



回答2:

https://downloads.gradle.org/distributions/gradle-2.3-all.zip

Download This File and Extract It, Then Copy all Files and Paste it Under:

C:\Users\{USERNAME}\.gradle\wrapper\dists\



回答3:

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



回答4:

1.Download the Gradle form gradle distribution

2.Extract file to some location

3.Open Android Studio : File > Settings > Gradle > Use local gradle distribution navigate the path where you have extracted the gradle.

4.click apply and ok

Done



回答5:

Assuming this is a windows system and we are using gradle-2.1-all [Applicable to any gradle version, just change the version as we need]

All the gradles can be found in http://services.gradle.org/distributions/


Check the <Your Project>\gradle\wrapper\gradle-wrapper.properties Make sure the distributionUrl is

distributionUrl=http\://services.gradle.org/distributions/gradle-2.1-all.zip

This is enough as it will automatically download the gradle.

After doing the above stuff, if you have downloaded the zip, paste the gradle-2.1-all.zip in

C:\Users\<username>\.gradle\wrapper\dists\gradle-2.1-all\<some_hash_key>\

It will save the extra downloading time.



回答6:

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.



回答7:

Step 1. Download the latest Gradle distribution

Step 2. Unpack the distribution

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.1 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

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.1\bin. Click OK to save.

Step 4. Verify your installation



回答8:

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.



回答9:

If you are on LINUX follow the steps below:

  • Go to the download https://gradle.org/ and download the latest zip file (currently 3.1 is the latest version)
  • Extract the downloaded zip file into /opt/android-studio/gradel/.

  • Open your project in Android Studio and hit Ctrl + Alt + S

  • Search for Gradel in the Search bar of the setting window

  • Select: (X) Use local gradle distribution and set Gradle home to /opt/andriod-studio/gradel/gradel.x.x (where x.x is the vesrion of the gradel zip file you just downloaded.). Then click on apply.

  • Try to sync Gradel again if the sync has already failed.If not close your project and reopen your project.

    Hope this solves your problem.



回答10:

1.Install gardle as per the given link http://services.gradle.org/distributions/ 2.Extract this downloaded file in C:\Gradle\gradle-4.5 location 3.set the environment of gradle This PC\properties\advance system settings\Environment variable 4.let's start Android studio And set the path of gradle C:\Gradle\gradle In Android studio