我的Flutter项目在Android Studio上无法运行。

huangapple go评论67阅读模式
英文:

my flutter project doesnt run on android studio

问题

I installed Android Studio,并使用开发者模式和USB调试尝试在手机上运行我的项目,但等待了几分钟后,在Android Studio中出现了以下错误:

Exception in thread "main" java.util.zip.ZipException: zip END header not found
	at java.base/java.util.zip.ZipFile$Source.zerror(ZipFile.java:1607)
	at java.base/java.util.zip.ZipFile$Source.findEND(ZipFile.java:1497)
	at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1504)
	at java.base/java.util.zip.ZipFile$Source.<init>(ZipFile.java:1308)
	at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1271)
	at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:733)
	at java.base/java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:850)
	at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:248)
	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)

我想要运行我的项目,但出现了这个错误。我尝试删除了Flutter SDK并重新安装它,但仍然没有解决问题,我仍然遇到这个错误。

英文:

well i installed android studio and using developer mode and usb debugging i tried to run my project on my phone but after few minutes of waiting this error appear in android studio:

Exception in thread &quot;main&quot; java.util.zip.ZipException: zip END header not found
	at java.base/java.util.zip.ZipFile$Source.zerror(ZipFile.java:1607)
	at java.base/java.util.zip.ZipFile$Source.findEND(ZipFile.java:1497)
	at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1504)
	at java.base/java.util.zip.ZipFile$Source.&lt;init&gt;(ZipFile.java:1308)
	at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1271)
	at java.base/java.util.zip.ZipFile$CleanableResource.&lt;init&gt;(ZipFile.java:733)
	at java.base/java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:850)
	at java.base/java.util.zip.ZipFile.&lt;init&gt;(ZipFile.java:248)
	at java.base/java.util.zip.ZipFile.&lt;init&gt;(ZipFile.java:177)
	at java.base/java.util.zip.ZipFile.&lt;init&gt;(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)

i want run my project but this error appear,i tried deleting my flutter sdk and reinstalling it but that didnt do the trick and i still get this error

答案1

得分: 1

错误与Gradle相关,通常是由于Gradle设置损坏或不完整导致的。要解决此问题,请转到用户根目录,找到隐藏的.gradle文件夹并将其删除。

如果您使用的是Mac,请打开终端并执行以下命令:

cd ~
rm -rf .gradle

然后运行您的应用程序连接到Android模拟器或设备,不要取消操作,并确保有稳定的互联网连接,这将下载全新的Gradle。

英文:

The error is related to Gradle, this is usually due to a corrupt or incomplete Gradle setup. To resolve it, Go to the user root directory and locate the hidden .gradle folder and delete it.
If you're on a mac, open the terminal and execute

cd ~
rm -rf .gradle

and then run your app connected to an Android emulator or device, don't cancel, and make sure to have a stable internet connection, this will download fresh Gradle.

huangapple
  • 本文由 发表于 2023年5月17日 22:36:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/76273295.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定