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
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
'2oz4ud9k3tuxjg84bbf55q0tn'
may be different in your PC.flutter run -v
Try this if you have fast & stable internet connection.
Flutter Doctor will give right result.
Tools > flutter >Flutter for editing
in android studioand 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.
Please use the below command
1.Mac User :
rm -rf ~/.gradle
2.Windows User :
remove the .gradle file
.gradle file location -> C:\Users\myUser
I solve this error by updating the gradle plugin/version. I have as part of my configuration:
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:
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
}
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 thisdistributionUrl=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 projectflutter pub get
: update your dependenciesflutter run
: run the project. Now it must work, at least it work for meI 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:
1. Open flutter project in a Text-Editor like VSCode.
2. Open android -> gradle -> wrapper -> 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
5. Then go to the wrapper->dists and find "gradle-6.7.1.all" folder
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!
This error is caused by corrupted gradle files, this is either due to incomplete downloads due to network issues. To solve it easily download the gradle zipped file from https://downloads.gradle-dn.com/distributions/gradle-6.7-all.zip and paste on the .gradle directory as shown below if you are on linux enter image description here
I solve this error by deleting the .gradle folder.
This location is gradle folder In Windows: C:> Users> {PC Name}>. Gradle
After deleting this folder, you only need to run the application again in Android Studio. At this point, Android Studio starts downloading the deleted folder automatically. enter image description here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With