flutterandroid-studiodart

Flutter Gradle task assembleDebug failed with exit code 1 zip END header not found


Hello I am new to Flutter I have setup flutter with android studio 4.2.1, and every thing is fine. When I try to run it; it show me following error I see too much questions but it is not helpfull for me flutter doctor run no issue found Hers is doctor result

Here is my enviroment variable

can any one guide me how can I run the flutter. I am lunching it in a chrome

exception in thread "main" java.util.zip.ZipException: zip END header not found at java.base/java.util.zip.ZipFile$Source.zerror(ZipFile.java:1567) at java.base/java.util.zip.ZipFile$Source.findEND(ZipFile.java:1462) at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1469) at java.base/java.util.zip.ZipFile$Source.(ZipFile.java:1274) at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1237) at java.base/java.util.zip.ZipFile$CleanableResource.(ZipFile.java:727) at java.base/java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:844) at java.base/java.util.zip.ZipFile.(ZipFile.java:247) at java.base/java.util.zip.ZipFile.(ZipFile.java:177) at java.base/java.util.zip.ZipFile.(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


Solution

  • I recently Solved this problem. This Problem came from gradle file is corrupted in my system. I'm using Linux so this steps almost same in windows also. This answer is for any gradle version.

    Open File Manager: enable Show hidden folder from top menu bar.

    You may find this location : .gradle>wrapper>dists.

    In Linux: Home > .gradle > wrapper > dists.

    In Windows: C:>Users>{PC Name}>.gradle>wrapper>dists


    Method 1

    1. Go inside gradle-6.5-all > dists > 2oz4ud9k3tuxjg84bbf55q0tn. '2oz4ud9k3tuxjg84bbf55q0tn' may be different in your PC.
    2. Delete all files in that folder and download required file manually: https://downloads.gradle-dn.com/distributions/gradle-6.5-all.zip enter image description here
    3. after download paste freshly downloaded zip file in that folder.
    4. Run your project flutter run -v

    Method 2

    Try this if you have fast & stable internet connection.

    1. Delete that gradle-6.5-all folder. enter image description here
    2. Open project in VS code or Android Studio and open terminal.
    3. Run this command flutter run -v

    Method 3

    Flutter Doctor will give right result.

    1. Open Android Studio
    2. Create new flutter project
    3. Click on Tools > flutter >Flutter for editing in android studio

    and wait, flutter doctor takes time to identify problem.


    Use this link for download gradle file. Replace 6.5 with your gradle version. https://downloads.gradle-dn.com/distributions/gradle-6.5-all.zip

    I hope this answer helpful for you.