Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle Could not expand ZIP: is not a ZIP archive

Tags:

gradle

zip

I am trying to unzip an archive file in my Gradle build script.

The archive file exists, and I have checked that it is indeed a zip file by running

file myfile.zip

However, build fails with the following error:

Could not expand ZIP '/.../file.zip': is not a ZIP archive

like image 393
Vic Seedoubleyew Avatar asked Jan 17 '18 19:01

Vic Seedoubleyew


4 Answers

For Windows: Please delete the package of the zip file and clean gradle. It will resolve.

like image 51
Praveen Kumar Verma Avatar answered Nov 10 '22 03:11

Praveen Kumar Verma


One reason this can happen is if the file is damaged or corrupted.

The way to check that is to try manually unzipping the file.

like image 35
Vic Seedoubleyew Avatar answered Nov 10 '22 03:11

Vic Seedoubleyew


For me, the problem was semi-unrelated. My build directory was owned by root and I was running as a user that did not have permissions to write there. I ended up deleting the dir and the next gradle build handled it.

like image 35
Darrien Avatar answered Nov 10 '22 01:11

Darrien


Yes.. it was due to permission on that file.

For windows:

  1. Give the permission including parent folder as same administrator.
  2. Try it to do it again.

If still not work, delete the zip file and let them create again after 1st step. It will resolve.

like image 25
Manjesh Rathore Avatar answered Nov 10 '22 03:11

Manjesh Rathore