When I try to build a project on Android Studio, I get this error:
Compilation completed with 1 error and 0 warnings in 9 sec 1 error 0 warnings org.gradle.tooling.GradleConnectionException: Could not install Gradle distribution from 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.: Could not install Gradle distribution from 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.
What can I do to fix it?
When I look at the Error Log, I saw this:
org.jetbrains.plugins.gradle.settings.GradleSettings cannot be cast to org.jetbrains.plugins.gradle.settings.GradleSettings: org.jetbrains.plugins.gradle.settings.GradleSettings cannot be cast to org.jetbrains.plugins.gradle.settings.GradleSettings
Please read the log from:
- On Microsoft Windows:
[Windwos Drive]\Documents and Settings\[your username]\.AndroidStudioPreview\system\log
- On Mac and Linux:
And you will find the tmp download path of
gradle-1.6-bin.zip. For example, mine is:
2013-05-17 09:42:16,934 [ 283002] INFO - ution.rmi.RemoteProcessSupport - Unzipping C:\Documents and Settings\Kiki.J.Hu\.gradle\wrapper\dists\gradle-1.6-bin\72srdo3a5eb3bic159kar72vok\gradle-1.6-bin.zip to C:\Documents and Settings\Kiki.J.Hu\.gradle\wrapper\dists\gradle-1.6-bin\72srdo3a5eb3bic159kar72vok ... Caused by: com.intellij.openapi.externalSystem.model.ExternalSystemException: Could not install Gradle distribution from 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'. java.util.zip.ZipException: error in opening zip file
So I know the cause: I downloaded an incomplete ZIP package.
Then I downloaded the full ZIP package from
http://services.gradle.org/distributions/gradle-1.6-bin.zip manually and copied this ZIP package to:
C:\Documents and Settings\Kiki.J.Hu\.gradle\wrapper\dists\gradle-1.6-bin\72srdo3a5eb3bic159kar72vok\
- Mac OS X:
Everything is OK now.
Before you click to new project, go to configure and set your proxy. I recommend set host name and port number, since I had problems with auto-detect proxy settings. Check your connection in settings.
I also had issues downloading Gradle through Android Studio.
This was my workaround:
- Download Gradle directly from http://services.gradle.org/distributions/gradle-1.6-bin.zip
- Copy the contents of gradle-1.6 to \Android\android-studio\plugins\gradle
- Copy gradle.jar to \Android\android-studio\lib\
- Restart Android Studio
Hope this helps!
Edit the gradle wrapper settings in
gradle/wrapper/gradle-wrapper.properties and change gradle-1.6-bin.zip to gradle-1.8-bin.zip.
#Wed Apr 10 15:27:10 PDT 2013 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip
It should compile without any error now.
In my case this was because the system had low memory. When I closed some applications, the error disappeared.
For me it turned out to be my firewall, which is VIPRE, was blocking the Gradle.org site and quietly causing a bad
gradle-1.7-bin.zip to be created under
I had to open VIPRE and add gradle.org to "Bad Web Site Exceptions" (menu File -> Settings -> Firewall).
Then I downloaded
http://services.gradle.org/distributions/gradle-1.7-bin.zip using a browser and overwrote the bad version. I restarted Android Studio, and all is good.
FYI, on my Mac, it was downloading Gradle into the
~/.gradle directory. You can see how it's progressing by looking there:
I noticed that my
MyProject/gradle/wrapper/gradle-wrapper.properties file was completely empty, so I deleted it and Android Studio proceeded to download whatever it needed.
After that it worked.
If you're like me, you tried to start a version prior to 0.2.0. Following Google's notes in Getting Started with Android Studio, you'll need to remove and re-install Android Studio.
"Note: There is not a patch update available from 0.1.9 to 0.2. To update from Android Studio 0.1.x to 0.2.x, you must install a new Android Studio bundle from this page. The reason for that is that we have made changes to the bundled SDK such that it includes a pre-configured local Maven repository which can serve up the v4 support library and which is required for creating new projects."
Also be aware that if you have your Android SDK files stored in
C:\Program Files (x86)\Android\android-studio\sdk you should move them before the uninstall, or you'll need to download the SDK files again.
After the un-install and re-install, it is now working on my Windows 7 64-bit system.
Remove all files from
C:\Documents and Settings\[User]\.gradle\wrapper\dists\, rebuild the project and rebuild your project on Android Studio. It works for me :)
I have noticed one thing: When my Android Studio is build 130.737825, it automatic downloads Gradle 1.6 to
However, when I update my Android Studio to build 132.821530, it automatically downloads Gradle 1.7 to
I don't know if it matters.
I had this error under fresh installation of IntelliJ (14.0), the problem was that I had not specified JDK. Fix: press ctrl + A + S (project structure), and check if SDK is correct.
my error looked like this:
Error:Android Gradle Build Target: org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle installation ...