Flutter ios release build cannot find snapshot

1,114

Solution 1

I've been seeing this issue frequently over the last few days. I recreated my ios directory which fixed the issue temporarily, but it came back.

What I learned is that it is expected that kernel_blob.bin is not present in release builds, because that file contains your Dart sources in bytecode form ready for JIT, but release builds don't use JIT, they use AOT and your Dart files are compiled into a binary that is placed under App.framework. Rather, this error happens because the release build of the app is incorrectly incorporating the debug (i.e. JIT) version of the Flutter engine.

The best solution I've found so far is to move the build folder to the trash (flutter clean is not working and hangs indefinitely on deleting the build folder for some reason), run flutter clean, run flutter build ios --release from the command line first, then (in my case) create the archive in Xcode.

Run flutter doctor -v

Solution 2

I have resolved this problem, if someone happened, you can try this.

Remove Flutter.framework, build again. Make sure Flutter.framework and App.framework are the same debug or release mode.

Share:
1,114
Prabhdeep Singh
Author by

Prabhdeep Singh

Updated on December 15, 2022

Comments

  • Prabhdeep Singh
    Prabhdeep Singh 11 minutes

    While trying to build flutter ios app for release I am getting this error every time

    Failed to find snapshot: /var/containers/Bundle/Application/19D78607-A03B/Runner.app/Frameworks/App.framework/flutter_assets/kernel_blob.bin
    

    I have tried these things to correct it but failed

    1. running flutter clean and then flutter run --release
    2. changing flutter channel to beta and master
    3. deleting build folder and then flutter clean and flutter run --release
    4. flutter clean > flutter build ios > archive in Xcode to test on the test flight

    Does anyone know how to fix it?

  • Prabhdeep Singh
    Prabhdeep Singh about 3 years
    just a copy pasted answer from here github.com/flutter/flutter/issues/33292 Not helpful
  • Arun Basil Issac over 2 years
    After running this Xcode is showing new error "ld: framework not found App"