Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter error : Target kernel_snapshot failed: Exception

after I upgrade Flutter version the project accidently throw many errors. and this are errors which I don't understand how to solve.

Target kernel_snapshot failed: Exception

FAILURE: Build failed with an exception.

  • Where: Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1151

  • What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command 'C:\flutter\bin\flutter.bat'' finished with non-zero exit value 1

[enter image description here](https://i.sstatic.net/1jpnr.png)

  • I tried flutter clean , flutter pub get , flutter pub upgrade
  • Also i tried : distributionUrl=https://services.gradle.org/distributions/gradle-7.5-all.zip _ And also I removed the cache in my C/username/Appdata/local/cache and re run my app => same error
  • tried removing build folder and pubspec.lock and re run . My files which can help to solve my problem :
    • pubspec.yaml enter image description here

    • android/build.gradle enter image description here

    • app/build.gradle enter image description here

like image 904
Mostafa Ahmed Avatar asked Apr 24 '26 20:04

Mostafa Ahmed


2 Answers

Solved ! As can be seen in screenshots that there are some errors of packages (flutter_local_notifications - modal_bottom_sheet )

1 - I deleted cache folder in C/$user_name/AppData/Local/Pub

2 - Updated all packages manually including flutter_local_notifications

3 - Added under dependency_overrides this package

modal_bottom_sheet: git: url: https://github.com/danReynolds/modal_bottom_sheet.git path: modal_bottom_sheet

4 - run flutter clean

5 - run your project successfully

like image 66
Mostafa Ahmed Avatar answered Apr 27 '26 10:04

Mostafa Ahmed


As can be seen in your linked screenshot, there's an issue with how flutter_local_notifications uses a wrong signature for a class from flutter_local_notifications_platform_interface. This is probably a result of invalid version constraints made by the developer in the 10.0.0-dev.1 prerelease version that you're using.

I would recommend updating the flutter_local_notifications to the latest version (as of the time I'm responding is 13.0.0).

If you can't do that, you can at least update to a stable version. The one you're using is a prerelease version according to semantic versioning. Try version 10.0.0.

like image 20
Albert221 Avatar answered Apr 27 '26 08:04

Albert221



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!