Reputation: 425
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
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
Reputation: 565
I have resolved the same problem. Try to exit Android Studio. Then, open again with "Run as administrator"
Upvotes: 7
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
Reputation: 4283
The only think that works for me was:
Click on the error link to download the gradle zip.
Then go to C:\Users\YourUsername\.gradle\native
and drop the
content of the zip.
Open AndroidStudio, go to File->Settings->Build,Execution,Deployment->Gradle
Change "Use Gradle from:" to "Specified location" and paste the
direction C:\Users\YourUsername\.gradle\native\NameOfTheZipContent
Apply, Ok
Sometimes needs to open/close AndroidStudio
Upvotes: 8
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
After this, Gradle re-downloaded all dependencies and the build was successful.
Upvotes: 48
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