Skip to content Skip to sidebar Skip to footer

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

Solution 1:

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.

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

There are 2 folders.

  1. gradle-6.7.1-bin
  2. gradle-6.7-all

Click on gradle-6.7.1-bin > 'gradle-6.7.1-bin.zip' and try to open if opened and there some files are there, then that file is fine.

Click on gradle-6.7-all > gradle-6.7-all.zip try to open if opened and there files are there, then that file is fine.

If not opened, that file is corrupted.

Most of time gradle-6.7-all.zip file will be corrupted. So you need to download it manually: https://downloads.gradle-dn.com/distributions/gradle-6.7-all.zip

and delete that corrupted zip file and paste freshly downloaded zip file. And make sure downloaded file is opening or not.


2 Method

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.


I hope this answer helpful for you.


Solution 2:

I solve this error by updating the gradle plugin/version. I have as part of my configuration:

  • Windows 10
  • Android Studio 4.2.1
  • Java 11: Android Studio 4.2.1 don't have support for JDK 16, so, I installed JDK 11, and configured the AS (how to change the jdk in AS) to use this older JDK
  • Gradle 7.0.1

By default, when you create a new Flutter project, the IDE created it with basic standard configurations, so you have to change this configs to fit your current config. For that, you need to update the gradle config in the flutter project, as follow:

  • in android/gradle/build.gradle file: update the gradle plugin to 4.2.0 in the dependencies section, like this:
dependencies {
    classpath 'com.android.tools.build:gradle:4.2.0'
    //more dependencies
}
  • in android/gradle/wrapper/gradle-wrapper.properties file: update the gradle version, in this case I have the 7.0.1, feel free to use another one, like this
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.1-all.zip
//more attributes

After you change the gradle config, run this commands in your project:

  • flutter clean : clean the project
  • flutter pub get : update your dependencies
  • flutter run : run the project. Now it must work, at least it work for me

Solution 3:


Solution 4:

Welcome SO.

Java 16/latest version is not fully compatible with the Gradle 6 at this moment. Try to use java 11 or 8, it will resolve your issue.


Solution 5:

I faced the same problem in VSCode when I wanted to run the Flutter app I got that error, so after lots of debugging and research, I found the solution. it's pretty easy, just follow these steps:

In windows 10:

1. Open flutter project in a Text-Editor like VSCode.

2. Open android -> gradle -> wrapper -> gradle-wrapper.properties find gradle wrapper properties

3. You will find "gradle-6.7.1.all.zip" inside gradle-wrapper folder

4. Go to this path: C:\Users\your-user find .gradle folder in windows

5. Then go to the wrapper->dists and find "gradle-6.7.1.all" folder find gradle file in android

5. Delete this folder.

6. Then come to VSCode and open Terminal.

7. Please make sure that you have stable internet connection then type this command in terminal

8. flutter run

I hope this solution can help you!


Post a Comment for "Flutter Gradle Task AssembleDebug Failed With Exit Code 1 Zip END Header Not Found"