Android studio - Failed to complete gradle execution - error in opening zip file
For me the solution to this error was to change the gradle wrapper version in ../gradle/wraper/gradle-wrapper.properties to a different/newer version.. I used:
distributionUrl=https://services.gradle.org/distributions/gradle-2.14.1-all.zip
Then call:
./gradlew --refresh-dependencies
This tells the wrapper to point to a new version and re-download all required dependencies. I suspect the error for me was caused by an interrupted download when first building the relevant project.
If you have limited internet plan then use the following method.
Step1: Close android studio
Step2: Go to C:\Users\Khurshid\.gradle\wrapper\dists\gradle-1.12-all\2apkk7d25miauqf1pdjp1bm0uo (if you want to configure gradle 1.12)
Step3: try to open the gradle-1.12-all.zip by double clicking it. If it gives error message then delete the zip file.
step4: go to https://services.gradle.org/distributions and download gradle-1.12-all.zip (54mb approx) and copy the same to the folder where you have previously deleted the zip file.
step5: open android studio and go to file->setting select 'gradle' and click on 'use local gradle distribution' and set 'gradle home' to 'C:\Users\Khurshid\.gradle\wrapper\dists\gradle-1.12-all\2apkk7d25miauqf1pdjp1bm0uo\gradle-1.12-all.zip' and click ok.
step6: It will download some file over the internet. If download doesn't start automatically then restart android studio.
step7: Be patience and let it download some important stuff and after that everything should be working fine. This method will help you save your internet data. Downloading the entire gradle directory will consume double the data.
Thank You
I also faced the similar issue when imported the existing project into Android Studio, this might happened because of gradle version mismatch between two different Android Studio platform.
Solution(on Mac OS):
- Close the Android Studio.
- Locate the .gradle folder at User/.gradle/
- Delete the folder & clear the Trash.
- Relaunch the Android Studio & Sync your project. It will re-download the gradle plugins & configurations.
An "error in opening zip file" tends to mean that a file that Gradle has downloaded has somehow become corrupted -- this might be the download of Gradle itself (which the wrapper does), or a dependency that Gradle has downloaded to run your build.
Gradle doesn't attempt to detect or resolve the problem, so you need to fix it manually. The solution is often to purge Gradle's download caches and let it get fresh copies of what it needs. To do that, delete the .gradle
directories in both your home directory and in your project's root directory and try building again.