我在flutter中运行项目时遇到这样的错误。为什么会发生这种情况以及如何修复此错误?
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
为什么会发生这种情况?
=
对于mac用户:打开终端并执行
cd~
rm-rf. gradle
对于windows用户:
转到根目录C:\用户\YourUser并找到隐藏的. gradle文件夹并将其删除。然后运行连接到Android模拟器或设备的应用程序,不要取消并建立稳定的互联网连接,这将下载新鲜的Gradle
在我的情况下,首先我打开一个android文件夹
android
在gradle-wrapper.properties变化
分配URL=https://services.gradle.org/distributions/gradle-7.5-all.zip
to
分配URL=https://services.gradle.org/distributions/gradle-7.5.1-all.zip