安装 Firebase 依赖项后 Flutter 出现 Gradle 错误

问题描述 投票:0回答:0

因此,当我在 IOS 模拟器中运行代码时,它可以正常工作,但是当我尝试为 android 运行相同的代码时,它给了我 gradle 错误。我运行过如下命令:

flutter clean
flutter pub get
flutter run

这无法解决问题。我什至尝试更新我的 gradle 版本,但问题仍未解决。

我现在在项目中安装的依赖项:

cloud_firestore: ^4.5.0
cupertino_icons: ^1.0.2
firebase_analytics: ^10.2.0
firebase_auth: ^4.4.0
firebase_core: ^2.9.0

gradle-wrapper.properties:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip

即将到来的错误:

Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
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)
Running Gradle task 'assembleDebug'...                             380ms
Exception: Gradle task assembleDebug failed with exit code 1

我期待应用程序在安卓模拟器中打开

android flutter firebase dart gradle
© www.soinside.com 2019 - 2024. All rights reserved.