title: Android Studio 0.8.7: Error:Cause: error in opening zip file
body: <p>I'm attempting to import a new gradle Android project with AS 0.8.6 (have also tried 0.8.7). When importing I get the following error</p>
  
  <pre><code>Error:Cause: error in opening zip file
  </code></pre>
  
  <p>From my research, this is very likely a problem with downloading the gradle wrapper.</p>
  
  <p>I've tried deleting the ~/.gradle folder per the suggestion of another post on SO (<a href="https://stackoverflow.com/a/23839694/413254">https://stackoverflow.com/a/23839694/413254</a>). Upon restart the same thing happens. </p>
  
  <p>If I try to run a <code>./gradlew clean</code>, I get the following error: </p>
  
  <pre><code>Downloading http://services.gradle.org/distributions/gradle-1.12-all.zip
  
  Exception in thread "main" java.lang.RuntimeException: java.io.IOException: Invalid Http response
      at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:78)
      at org.gradle.wrapper.Install.createDist(Install.java:47)
      at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
      at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
  Caused by: java.io.IOException: Invalid Http response
      at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1342)
      at org.gradle.wrapper.Download.downloadInternal(Download.java:59)
      at org.gradle.wrapper.Download.download(Download.java:45)
      at org.gradle.wrapper.Install$1.call(Install.java:60)
      at org.gradle.wrapper.Install$1.call(Install.java:47)
      at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
      ... 3 more
  </code></pre>
  
  <p>Downloading manually (from a browser) via the url in my <code>gradle/wrapper/gradle-wrapper.properties</code> file doesn't give me any problems. </p>
  
  <pre><code>distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
  </code></pre>
  
  <p>EDIT: </p>
  
  <p>I also see the following when doing a <code>./gradlew clean</code> after a failed attempt to download</p>
  
  <pre><code>Unzipping /Users/user/.gradle/wrapper/dists/gradle-1.12-all/2apkk7d25miauqf1pdjp1bm0uo/gradle-1.12-all.zip to /Users/user/.gradle/wrapper/dists/gradle-1.12-all/2apkk7d25miauqf1pdjp1bm0uo
  Exception in thread "main" java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip file
      at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:78)
      at org.gradle.wrapper.Install.createDist(Install.java:47)
      at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
      at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
  Caused by: java.util.zip.ZipException: error in opening zip file
      at java.util.zip.ZipFile.open(Native Method)
      at java.util.zip.ZipFile.&lt;init&gt;(ZipFile.java:215)
      at java.util.zip.ZipFile.&lt;init&gt;(ZipFile.java:145)
      at java.util.zip.ZipFile.&lt;init&gt;(ZipFile.java:159)
      at org.gradle.wrapper.Install.unzip(Install.java:160)
      at org.gradle.wrapper.Install.access$400(Install.java:29)
      at org.gradle.wrapper.Install$1.call(Install.java:70)
      at org.gradle.wrapper.Install$1.call(Install.java:47)
      at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
      ... 3 more
  </code></pre>
  
  <p>I'm not sure it's of relevance or not, but there's a <code>gradle-1.12-all.zip.lck</code> file in the same directory with the <code>gradle-1.12-all.zip</code>. </p>
  
  <p>Attempting to unzip the zip results in a  cpgz file... which turns back into a zip. According to <a href="http://osxdaily.com/2013/02/13/open-zip-cpgz-file/" rel="nofollow noreferrer">http://osxdaily.com/2013/02/13/open-zip-cpgz-file/</a>, that's generally an indication of a corrupt download. </p>