gradle 线程“main”中出现异常,未找到zip END标头

hfyxw5xn  于 2023-03-23  发布在  其他
关注(0)|答案(2)|浏览(172)

我在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
zlhcx6iw

zlhcx6iw1#

为什么会这样

=〉该错误与Gradle相关,通常是由Gradle设置损坏或不完整引起的

如何修复此错误?

**mac用户:**打开终端执行

cd ~
rm -rf .gradle

windows用户:

转到根目录C:\Users\YourUser并找到隐藏的.gradle文件夹并将其删除。然后运行连接到Android模拟器或设备的应用程序,不要取消并保持稳定的互联网连接,这将下载新的Gradle

osh3o9ms

osh3o9ms2#

在我的情况下,首先我打开一个android文件夹
android〉gradel〉wrapper〉gradle-wrapper.properties
在gradle-wrapper.properties更改
分发网址=services.gradle.org/distributions/gradle-7.5-all.zip

to

分发网址=services.gradle.org/distributions/gradle-7.5.1-all.zip

相关问题