Vijai Gunasekar
Vijai Gunasekar

Reputation: 425

The specified Gradle distribution 'https://services.gradle.org/distributions/gradle-4.6-all.zip' does not appear to contain a Gradle distribution

I have two projects. One project is working without any issues. It was downloaded from gitlab. The other project was downloaded from github. github project has this issue. I want to use default gradle distribution. I want to know what wrong I did. Using local gradle distribution builds the project. But i get other issue - Precondition class not found. This issue is not my question here. Also I dont know if the gradle (local distribution or default) is causing the issue. Those things aside. I just want to know why I am getting - The specified Gradle distribution 'https://services.gradle.org/distributions/gradle-4.6-all.zip' does not appear to contain a Gradle distribution.

My team mates are not having any problem. They are running the project without any issues. The project which is building correctly used gradle 4.10.1. This project uses 4.6.

The specified Gradle distribution 'https://services.gradle.org/distributions/gradle-4.6-all.zip' does not appear to contain a Gradle distribution.

Upvotes: 32

Views: 66432

Answers (6)

Vijay
Vijay

Reputation: 11

I tried all the above solutions but it didn't work for me. Now what I found after doing a long research is that my "Gradle user home" directory's path was not set correctly even after installing a latest version of Android Studio(2024).

So what I suggest, first you should set your directory's (Main menu -> Settings -> Build,Execution,Development -> Build Tools -> Gradle -> "Gradle user home") path to C:/Users/UserName/.gradle. Now run your app.

NOTE: First check your directory's path if it already set as the above path (which I have mentioned) then it won't work. In my case the default path (before correction) was C:/program files/Android/Android Studio/Gradle.

Upvotes: 1

Thào A Vảng
Thào A Vảng

Reputation: 565

I have resolved the same problem. Try to exit Android Studio. Then, open again with "Run as administrator"

Upvotes: 7

Nestachio
Nestachio

Reputation: 69

Well, I tried all of the above solutions except for miguelarc's second solution, then I closed it and 'run android studio as administrator'(by right clicking on the icon), and it auto downloaded the gradle files just fine. No messing around with the files or change in settings were required for me.

Upvotes: 6

Lotan
Lotan

Reputation: 4283

The only think that works for me was:

  1. Click on the error link to download the gradle zip.

  2. Then go to C:\Users\YourUsername\.gradle\native and drop the content of the zip.

  3. Open AndroidStudio, go to File->Settings->Build,Execution,Deployment->Gradle

  4. Change "Use Gradle from:" to "Specified location" and paste the direction C:\Users\YourUsername\.gradle\native\NameOfTheZipContent

  5. Apply, Ok

  6. Sometimes needs to open/close AndroidStudio

Upvotes: 8

miguelarc
miguelarc

Reputation: 800

I was able to solve this issue by upgrading the Gradle Version (not the Android Gradle Plugin Version). Go to Project Structure -> Project example here

After this, Gradle re-downloaded all dependencies and the build was successful.

Upvotes: 48

Amin Keshavarzian
Amin Keshavarzian

Reputation: 3963

I managed to fix this by updating the gradle version number in Project Structure in Android Studio 3.4.1

File -> Project Structure -> Project -> Gradle Version

Upvotes: 16

Related Questions