'FLUTTER: java.io.StreamCorruptedException: File format not recognised

One moment the project was running fine but when i tried to debug the code again i got this error.

Launching lib\main.dart on SM A515F in debug mode...                          lib\main.dart:1
FAILURE: Build failed with an exception.

* What went wrong:
java.io.StreamCorruptedException: File format not recognised

* 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.

* Get more help at https://help.gradle.org


Solution 1:[1]

Can you run flutter clean followed by flutter pub get then flutter run

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 reza