5

Error:Failed to open zip file.

Gradle's dependency cache may be corrupted (this sometimes occurs after a network connection timeout.)

<a href="syncProject">Re-download dependencies and sync project (requires network)</a>
<a href="syncProject">Re-download dependencies and sync project (requires network)</a>

This happened yesterday. I'm not able to run any of my old project and I can't download this dependency though I have good internet connection.

Micho
  • 3,929
  • 13
  • 37
  • 40
  • See this [link](http://stackoverflow.com/questions/42593758/gradle-error-after-updating-to-android-studio-2-3/42603803#42603803) – bitvale Mar 05 '17 at 02:35

4 Answers4

3

I had a similar issue today after updating to Android Studio 2.3.

I had to update my build tools to 25.0.0 you can do this by changing the buildToolsVersion and changing the compileSdkVersion to 25 in the build.gradle file in your main module.

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    ...
}
Goke Obasa
  • 4,328
  • 1
  • 18
  • 26
1

I've had the same error and resolve by simply doing

Build > Clean

Build > Rebuild

If it does not work, refer to the link below.

https://stackoverflow.com/a/42609533/1358117

Community
  • 1
  • 1
Hello world
  • 353
  • 3
  • 18
0

Steps to solve this problem:

1) Replace Dependencies in build.gradle (project) by this code :

classpath 'com.android.tools.build:gradle:2.3.0'

2) Replace distributionUrl in Gradle-wrapper.properties by this code:

distributionUrl=https://services.gradle.org/distributions/gradle-3.3-all.zip

3) Don't forget to use Gradle default wrapper in Project level setting.

Deepak Kumar
  • 387
  • 4
  • 6
0

I also encountered this problem after accepting an update. I'm not sure if this is the right approach, but it solved this problem for me.

In build.gradle (Project), I replaced with the following:

classpath 'com.android.tools.build:gradle:1.5.0'

And in build.gradle (Module:app),

buildToolsVersion '23.0.1'

After which I Synced Project with Gradle Files. Everything worked fine afterwards, hope it helps you.

Emzor
  • 1,380
  • 17
  • 28