Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio error installing Gradle

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 
like image 403
Charlie-Blake Avatar asked May 16 '13 11:05

Charlie-Blake


People also ask

What is Gradle error in Android Studio?

In some cases when your Gradle files are deleted or corrupted you will not be able to download new Gradle files in android studio. In this case, we have to delete the Gradle files which are present already and then again sync your project to download our Gradle files again.

Does Android Studio install Gradle?

Android Studio will download gradle to sub dir named by a hash. To download manually, need to download to the exact sub dir named by the hash.

Why does Android Studio keep downloading Gradle?

Basically it downloads the Gradle build files for your current project according to its version and this whole work is done by your gradle wrapper which actually looks towards the basic requirement for your project and downloads the files according to that so whenever you are going to use any another projects of same ...


1 Answers

Please read the log from:

  • On Microsoft Windows: [Windwos Drive]\Documents and Settings\[your username]\.AndroidStudioPreview\system\log
  • On Mac and Linux: ~/.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:

  • Windows: C:\Documents and Settings\Kiki.J.Hu\.gradle\wrapper\dists\gradle-1.6-bin\72srdo3a5eb3bic159kar72vok\
  • Mac OS X: ~/.gradle/wrapper/dists/gradle-1.10-all/6vpvhqu0efs1fqmqr2decq1v12/

Everything is OK now.

like image 178
Kiki Hu Avatar answered Oct 02 '22 04:10

Kiki Hu