Flutter error - Invalid kernel binary format version (found 4, expected 6)
Asked Answered
U

2

7

When running my application after a upgrading flutter i am getting this error.

error: Invalid kernel binary format version (found 4, expected 6)

I am currently on master, I tried switch the branch tobeta`. Still no help. Here is the stack trace.

2018-05-28 15:22:46.214821+0530 Runner[579:57143] ../../third_party/dart/runtime/vm/kernel_binary.cc: 39: error: Invalid kernel binary format version (found 4, expected 6)
2018-05-28 15:22:46.214912+0530 Runner[579:57143] Dumping native stack trace for thread 7c03
2018-05-28 15:22:46.237923+0530 Runner[579:57143]   [0x0000000100fda4a0] dart::Profiler::DumpStackTrace(void*)
2018-05-28 15:22:46.239415+0530 Runner[579:57143]   [0x0000000100fda4a0] dart::Profiler::DumpStackTrace(void*)
2018-05-28 15:22:46.271484+0530 Runner[579:57143]   [0x0000000000000000] Unknown symbol
2018-05-28 15:22:46.273617+0530 Runner[579:57143]   [0x0000000100eda158] dart::kernel::Program::ReadFromBuffer(unsigned char const*, long, bool)
2018-05-28 15:22:46.273681+0530 Runner[579:57143] -- End of DumpStackTrace

Here's the output of flutter doctor.

Running flutter doctor... Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel master, v0.4.5-pre.98, on Mac OS X 10.13.3 17D47, locale en-IN) [✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.io/setup/#android-setup for detailed instructions).
      If Android SDK has been installed to a custom location, set $ANDROID_HOME to that location. [✓] iOS toolchain - develop for iOS devices (Xcode 9.2) [✗] Android Studio (not installed) [✓] IntelliJ IDEA Community Edition (version 2017.3.5) [✓] Connected devices (3 available)

! Doctor found issues in 2 categories.

What could be wrong? Please help.

Unnecessarily answered 28/5, 2018 at 9:56 Comment(0)
G
8

Fix: deleting the bin/cache directory in your Flutter installation directory, then run flutter doctor and try again. Usually, it will be C:\src\flutter.

Upgrade flutter if required.

Guevara answered 21/6, 2020 at 20:17 Comment(2)
after you delete bin/cache directory, running "flutter doctor" is not enough. you need to run "flutter precache" either.Yeomanry
@Yeomanry , where I could find it? It helped me, thank you!Piperidine
S
2

Try flutter clean - it seems you have some stale artifacts in build/ folder.

Stinko answered 28/5, 2018 at 12:39 Comment(6)
Where did you invoke it? (e.g. did you invoke it in the project folder where you see an error?). Also make sure to uninstall old version of your app from devices.Stinko
I invoked it inside the project folder. And yeah I did remove the previous versions.Unnecessarily
That's very strange - if you deleted everything there should be no mismatched version. What happens if you do: find . -iname '*.dill' in your project folder? Can you look at the dates of the files it finds? Do they look recent or do they look old? How did you upgrade to the newer flutter version? Did you restart your IDE between upgrades?Stinko
The command find . -iname '*.dill' gave three entries. One of them looks a few days older than the others. Heres the path : ./ios/Flutter/flutter_assets/platform.dillUnnecessarily
Try deleting this one (it should be restored automatically on build), then doing flutter clean and doing flutter run --debug.Stinko
./ios/Flutter/flutter_assets/platform.dill file did get updated even after upgradation. I had remove flutter completely and reinstall to make it work.Unnecessarily

© 2022 - 2024 — McMap. All rights reserved.