Manually install Gradle and use it in Android Studio
Solution 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
Solution 2
https://services.gradle.org/distributions/
Download The Latest Gradle Distribution File and Extract It, Then Copy all Files and Paste it Under:
C:\Users\{USERNAME}\.gradle\wrapper\dists\
Solution 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
Solution 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
EDIT 1: In the latest version of AS, the option is called "Use Gradle from: Specified location, thanks @Adam Burley for suggestion
Solution 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.
jackuars
Updated on May 21, 2021Comments
-
jackuars almost 3 years
I'm using Android Studio. How can I manually install and use
Gradle
withinAndroid 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..
-
jackuars over 9 yearsI am using my laptop offline, so I want to download and use from another source. Which is why am trying to do this manually.
-
jackuars over 9 yearsShould I define Environment variables for Gradle to get it to work? If so how?
-
Okas over 9 yearsNo, you dont need any special environment variables.
-
Larry Schiefer over 9 yearsTry temporarily changing the
distributionUrl
line to point to the zip on your filesystem, run your build (e.g.gradlew assemble
) then when it is done change it to the correct URL. That should force Gradle to "download" the package from your filesystem and set it up as it expects, while leaving other machines ok when you commit thegradle
directory to your VCS. -
guicey almost 8 yearsThank you Lee i edited my mistake. It is indeed Ctrl+ Alt + S instead of Ctrl+ Shift + S.
-
stackdave almost 7 yearsafter two days, i see clear with you reply, a lot of methods on the web with grep, etc, and it was simple
-
AaA almost 7 yearsWhich version of Android studio your answer applies to? in Android Studio 2.3.3 there is no Gradle under Settings Window (it is under Build, ... ) and it does not have such option as Use Local gradle distribuition
-
AaA almost 7 yearsRead the question again! it is asking
Manually
! and yet your answer saysautomatically
in an OFFLINE machine there is no way to download automatically! -
AaA almost 7 yearsRead the question again! it is asking
Manually
! and yet your answer saysautomatically
in anOFFLINE machine
there is no way to download automatically! -
AaA almost 7 yearsWhere do you press CTRL-ALT-S? in windows explorer after extracting the files?
-
Mukesh Y. almost 7 yearsfile->setting->Build,Execute,Deployment-> Gradle. then select Use Local gradle distribution check box and give the gradle path
-
guicey almost 7 years@AaA In Android Studio / IntelliJ IDEA, this shortcut opens your IDEA settings menu. I updated your feedback thank you.
-
Seth over 6 yearshow to get the hash key
-
Eric about 5 yearsWith android-studio 3.3, this won't work, unless you know exact hash, and put it under the hash dir.
-
Eric about 5 yearsThis works, but each time open project, android-studio will ask to confirm whether use gradlew instead. And I can't find an option to ignore that.
-
Eric about 5 years@TanyavonDegurechaff Check this answer which contains more details: stackoverflow.com/a/54924485
-
ardiien over 4 yearsbut how to set up
gradle.properties
then? For example, I want to addparallel
property but I do not want to changegradle.properties
from the team project. -
Eric over 4 years@YaroslavOvdiienko Does following answer your question: stackoverflow.com/questions/30333837/…
-
Mostafa Alayesh over 4 years@EricWang First you can let android studio start the download, then you stop it, and locate the file as Hackbal said, you will find the hash already created
-
Eboubaker about 4 yearsi think you have to escape the ':' with \:
-
gumuruh about 4 yearsi think he is using android studio 3 and not version 2.
-
Dr Deo almost 4 yearsThe option to use local gradle was there in earlier versions of android studio (version 3x) , then some bone head admin within the android team removed it in Android studio 4x.
-
Sergio Solorzano over 3 yearsand how do you start android studio to download?
-
Sergio Solorzano over 3 yearswhere do you add this?
-
Gunaseelan over 3 yearsIn gradle-wrapper.properties.
-
Abdulla Sirajudeen over 3 years@SergioSolorzano Then Just Start Android Studio as Normal. After Build Complete it will be work
-
Adam Burley about 3 yearsIn the latest version of AS, the option is called "Use Gradle from: Specified location"
-
Adam Burley about 3 yearsIn the latest version of AS, the option is called "Use Gradle from: Specified location"
-
Mustafa Muawia almost 3 years@Eboubaker thanks your notice was very usefull :)
-
Abhinav Kulshreshtha about 2 years@AdamBurley Even though I have set "Specific Location" to my system gradle, The build logs shows it still uses inbuild gradle. Funny thing is that when I went to write gradle path, it automatically detected its location based on my system env variables. On side note, I can't find option to use system kotlin compiler in last few versions. Inbuilt compiler is slow, I remember in old version, I could use system kotlin which improved build time performance by a lot.