skip to Main Content

I get such error while run a project in flutter. Why is this happening and how can I fix this error?

Exception in thread "main" java.util.zip.ZipException: zip END header not found
    at java.base/java.util.zip.ZipFile$Source.zerror(ZipFile.java:1581)
    at java.base/java.util.zip.ZipFile$Source.findEND(ZipFile.java:1476)
    at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1483)
    at java.base/java.util.zip.ZipFile$Source.<init>(ZipFile.java:1288)
    at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1251)
    at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:732)
    at java.base/java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:849)
    at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:247)
    at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:177)
    at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:191)
    at org.gradle.wrapper.Install.unzip(Install.java:214)
    at org.gradle.wrapper.Install.access$600(Install.java:27)
    at org.gradle.wrapper.Install$1.call(Install.java:74)
    at org.gradle.wrapper.Install$1.call(Install.java:48)
    at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
    at org.gradle.wrapper.Install.createDist(Install.java:48)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Exception: Gradle task assembleDebug failed with exit code 1

2

Answers


  1. Chosen as BEST ANSWER

    Why is this happening?

    => The error is related to Gradle, it is usually caused by a corrupt or incomplete Gradle setup

    how to fix this error?

    For mac user: open terminal and execute

    cd ~

    rm -rf .gradle

    For windows user:

    Go to the root directory C:UsersYourUser and locate the hidden .gradle folder and delete it. and then run your app connected to an Android emulator or device, don't cancel and make have a stable internet connection, this will download fresh Gradle


  2. in my case firstly I open an android folder

    android>gradel>wrapper>gradle-wrapper.properties

    in gradle-wrapper.properties change

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

                                    to
    

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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search