Reputation: 11050
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?
UPDATE:
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
Upvotes: 47
Views: 99418
Reputation: 6945
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.
Upvotes: 1
Reputation: 49976
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 ...
Upvotes: 0
Reputation: 686
Please read the log from:
[Windwos Drive]\Documents and Settings\[your username]\.AndroidStudioPreview\system\log
~/.AndroidStudioPreview/system/log/
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\
~/.gradle/wrapper/dists/gradle-1.10-all/6vpvhqu0efs1fqmqr2decq1v12/
Everything is OK now.
Upvotes: 67
Reputation: 6682
I have noticed one thing: When my Android Studio is build 130.737825, it automatic downloads Gradle 1.6 to C:\Users\yourname\.gradle/wrapper/dists/gradle-1.6-bin/72srdo3a5eb3bic159kar72vok/
.
However, when I update my Android Studio to build 132.821530, it automatically downloads Gradle 1.7 to C:\Users\Administrator\.gradle\wrapper\dists\gradle-1.7-bin\2g3i7gan25uopmtc0lnjb1l9ff
.
I don't know if it matters.
Upvotes: 0
Reputation: 11
FYI, on my Mac, it was downloading Gradle into the ~/.gradle
directory. You can see how it's progressing by looking there:
du ~/.gradle
Upvotes: 1
Reputation: 9990
In my case this was because the system had low memory. When I closed some applications, the error disappeared.
Upvotes: 2
Reputation: 199
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 .gradle\wrapper\dists\
.
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.
Upvotes: 1
Reputation: 1
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 :)
Upvotes: 0
Reputation: 31
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.
Upvotes: 0
Reputation: 1959
For OS X:
Install Homebrew as a package manager. Then on Terminal, run:
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
Install Gradle:
brew install gradle
It is the easiest way to get Gradle.
Upvotes: 8
Reputation: 3400
I tried Kiki Hu's solution, and it worked. After that, there will be more downloads from the Maven repository which includes Dalvik Debug Monitor Server (DDMS), Guava, etc., which again is not required if you are exporting from Eclipse into Android Studio.
Upvotes: 0
Reputation: 17119
Edit the gradle wrapper settings in gradle/wrapper/gradle-wrapper.properties
and change gradle-1.6-bin.zip to gradle-1.8-bin.zip.
./gradle/wrapper/gradle-wrapper.properties :
#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.
Upvotes: 2
Reputation: 758
I also had issues downloading Gradle through Android Studio.
This was my workaround:
Hope this helps!
Upvotes: 2
Reputation: 195
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.
Upvotes: 2