I’m doing a big app project in Flutter, I’ve been working on it for various weeks and suddenly I started getting this error when building/running:
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:desugarDebugFileDependencies'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> zip END header not found
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> newPosition < 0: (-1 < 0)
The problem has somewhat to do with my own computer, as other people working on my same branch are not getting this error. I’ve looked into every similar post online, but I still wasn’t able to solve it.
Here’s my flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.8.1, on Microsoft Windows [Versione 10.0.19042.1415], locale it-IT)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.9.3)
[√] Android Studio (version 4.2)
[√] IntelliJ IDEA Ultimate Edition (version 2020.3)
[√] VS Code (version 1.54.3)
[√] Connected device (3 available)
• No issues found!
I tried deleting the whole project and re-creating it again from remote. It worked for a few days and then this again. I have no idea on how to proceed and any help would be much apreciated.
2
Answers
Run the following command on terminal:
Thereafter run flutter pub get . Make sure your pc is connected with wifi.
it’s just because your target device android API version is more than your target SDK version