Mahesh Kumthekar
Mahesh Kumthekar

Reputation: 63

Error:Failed to open zip file. Gradle dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)

Error:Failed to open zip file. Gradle dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.parse.bolts:bolts-android:1.+'
    compile 'com.parse:parse-android:1.+'
    compile 'com.android.support:appcompat-v7:23.2.0'
    compile 'com.android.support:recyclerview-v7:23.2.0'
    compile 'com.facebook.android:facebook-android-sdk:4.0.0'
    compile 'com.android.support:design:23.2.0'
    compile 'com.android.support:support-v4:23.2.0'
}

Upvotes: 4

Views: 19950

Answers (5)

Megh
Megh

Reputation: 61

Hard and fast solution for MacOS (and possibly Linux)

  1. Go to ~/.gradle
  2. Delete all files: rm -rf .gradle
  3. Go to your project folder and do : ./gradlew bootRun

The last step should download all gradle dependencies again.

Upvotes: 0

Hamid Asghari
Hamid Asghari

Reputation: 5889

Repair Gradle Installation

(From my answer at https://stackoverflow.com/a/43801113/7120475)

This usually happens when something goes wrong in Android Studio's first launch (eg. system crash, connection loss or whatever).

To resolve this issue close Android Studio and delete the following directory's content, necessary files will be downloaded on IDE's next launch.

macOS: ~/.gradle/wrapper/dists

Windows: C:\Users\your-username\.gradle\wrapper\dists

While downloading Gradle manually works, I recommend letting Android Studio itself to do it.

Upvotes: 6

Solanki Mimoh
Solanki Mimoh

Reputation: 86

Hey not necessary to set gradle manually. i have also faced this issue but i deleted all files in gradle folder path "C:/Users/username/.gradle/" simple steps follow

  1. first goto path "C:/Users/MickeyMouse/.gradle/"
  2. delete all files in above path.
  3. List item open android studio and sync gradle or build again or create new project.
  4. List item it will be auto downloaded new gradle version files and auto build.

*Make sure you your gradle settings like this - checked "Use default gradle wrapper(recommended) - unchecked offline work

Upvotes: 1

user4670726
user4670726

Reputation:

I faced the same issue when I updated my android studio to 2.2.3 from 2.1. After a while of struggling, went project->right click -> open module settings->project

1) Gradle : 2.14.1
2) Android plugin version : 2.2.3
3) Android plugin repository : jcenter
4) Default library repository : jcenter

Upvotes: 15

Sanket B
Sanket B

Reputation: 1119

Mine worked after I added my NDK path in Android Studio.

File -> Project Structure -> SDK Location -> Android NDK Location

Upvotes: 0

Related Questions