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

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.

I hope this answer helpful for you.

Leave a Comment