Unable to build my Flutter app with snapcraft anymore

For months building the newest version of FluffyChat was never a problem but since the new version of the Flutter Snap I can not build it anymore for amd64. For arm64 it works fine though.

I get this error:

[        ] [  +17 ms] Found plugin integration_test at /root/snap/flutter/common/flutter/packages/integration_test/
[        ] [  +48 ms] gen_dart_plugin_registrant: Complete
[        ] [   +2 ms] unpack_linux: Complete
[        ] [ +669 ms] kernel_snapshot: Starting due to {}
[   +3 ms] [  +41 ms] /root/snap/flutter/common/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev
/root/snap/flutter/common/flutter/bin/cache/dart-sdk/bin/snapshots/frontend_server.dart.snapshot --sdk-root
/root/snap/flutter/common/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk_product/ --target=flutter --no-print-incremental-dependencies -Ddart.vm.profile=false
-Ddart.vm.product=true --compact-async --aot --tfa --packages /root/parts/fluffychat/build/.dart_tool/package_config.json --output-dill
/root/parts/fluffychat/build/.dart_tool/flutter_build/d49f9883eee2707b0e082b3ff574685d/app.dill --depfile
/root/parts/fluffychat/build/.dart_tool/flutter_build/d49f9883eee2707b0e082b3ff574685d/kernel_snapshot.d --source
/root/parts/fluffychat/build/.dart_tool/flutter_build/dart_plugin_registrant.dart --source package:flutter/src/dart_plugin_registrant.dart
-Dflutter.dart_plugin_registrant=file:///root/parts/fluffychat/build/.dart_tool/flutter_build/dart_plugin_registrant.dart --verbosity=error package:fluffychat/main.dart
[   +3 ms] [+85299 ms] Persisting file store
[        ] [  +12 ms] Done persisting file store
[        ] [   +9 ms] Target kernel_snapshot failed: Exception
[        ]            #0      KernelSnapshot.build (package:flutter_tools/src/build_system/targets/common.dart:244:7)
[        ]            <asynchronous suspension>
[        ]            #1      _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:839:9)
[        ]            <asynchronous suspension>
[        ]            #2      Future.wait.<anonymous closure> (dart:async/future.dart:522:21)
[        ]            <asynchronous suspension>
[        ]            #3      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:777:32)
[        ]            <asynchronous suspension>
[        ]            #4      Future.wait.<anonymous closure> (dart:async/future.dart:522:21)
[        ]            <asynchronous suspension>
[        ]            #5      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:777:32)
[        ]            <asynchronous suspension>
[        ]            #6      Future.wait.<anonymous closure> (dart:async/future.dart:522:21)
[        ]            <asynchronous suspension>
[        ]            #7      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:777:32)
[        ]            <asynchronous suspension>
[        ]            #8      FlutterBuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:606:16)
[        ]            <asynchronous suspension>
[        ]            #9      AssembleCommand.runCommand (package:flutter_tools/src/commands/assemble.dart:316:32)
[        ]            <asynchronous suspension>
[        ]            #10     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1209:27)
[        ]            <asynchronous suspension>
[        ]            #11     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
[        ]            <asynchronous suspension>
[        ]            #12     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
[        ]            <asynchronous suspension>
[        ]            #13     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
[        ]            <asynchronous suspension>
[        ]            #14     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
[        ]            <asynchronous suspension>
[        ]            #15     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
[        ]            <asynchronous suspension>
[        ]            #16     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
[        ]            <asynchronous suspension>
[        ]            #17     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
[        ]            <asynchronous suspension>
[        ]            #18     main (package:flutter_tools/executable.dart:91:3)
[        ]            <asynchronous suspension>
[        ] [  +26 ms] "flutter assemble" took 90,850ms.
[        ] [  +11 ms] 
[        ]            #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
[        ]            #1      AssembleCommand.runCommand (package:flutter_tools/src/commands/assemble.dart:333:7)
[        ]            <asynchronous suspension>
[        ]            #2      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1209:27)
[        ]            <asynchronous suspension>
[        ]            #3      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
[        ]            <asynchronous suspension>
[        ]            #4      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
[        ]            <asynchronous suspension>
[        ]            #5      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
[        ]            <asynchronous suspension>
[        ]            #6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
[        ]            <asynchronous suspension>
[        ]            #7      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
[        ]            <asynchronous suspension>
[        ]            #8      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
[        ]            <asynchronous suspension>
[        ]            #9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
[        ]            <asynchronous suspension>
[        ]            #10     main (package:flutter_tools/executable.dart:91:3)
[        ]            <asynchronous suspension>
[        ] [ +255 ms] ensureAnalyticsSent: 253ms
[        ] [   +2 ms] Running shutdown hooks
[        ] [        ] Shutdown hooks complete
[        ] [   +1 ms] exiting with code 1
[        ] ninja: build stopped: subcommand failed.
[  +42 ms] Building Linux application... (completed in 97.9s)
[   +3 ms] "flutter linux" took 99,948ms.
[  +11 ms] Build process failed
[   +4 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      _runBuild (package:flutter_tools/src/linux/build_linux.dart:185:5)
           <asynchronous suspension>
           #2      buildLinux (package:flutter_tools/src/linux/build_linux.dart:78:5)
           <asynchronous suspension>
           #3      BuildLinuxCommand.runCommand (package:flutter_tools/src/commands/build_linux.dart:85:5)
           <asynchronous suspension>
           #4      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1209:27)
           <asynchronous suspension>
           #5      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #6      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
           <asynchronous suspension>
           #8      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #9      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
           <asynchronous suspension>
           #10     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
           #11     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #12     main (package:flutter_tools/executable.dart:91:3)
           <asynchronous suspension>
           
           
[ +234 ms] ensureAnalyticsSent: 232ms
[   +2 ms] Running shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 1
Failed to run 'flutter build linux --release -v -t lib/main.dart' for 'fluffychat': Exited with code 1.
Verify that the part is using the correct parameters and try again.
Run the same command again with --debug to shell into the environment if you wish to introspect this failure.

I have also tried the approach of the new software snap to use flutter from git: https://github.com/ubuntu-flutter-community/software/blob/main/snap/snapcraft.yaml#L20-L40 but this also does not work with this error:

Generated snap metadata                                                                          
Cannot pack snap file: Command '['snap', 'pack', '--filename', 'fluffychat_v1.6.4-132-g7e6a424b_amd64.snap', '--compression', 'xz', PosixPath('/root/prime'), PosixPath('/root/project')]' returned non-zero exit status 1. (2022/11/15 18:28:50.526358 container.go:215: in snap "fluffychat": path "fluffychat" does not exist
error: cannot pack "/root/prime": snap is unusable due to missing files)                                                                                                
Failed to execute pack in instance.                                                              

The Flutter Snap was always broken for me and never worked so locally I always use the git version but now I can’t publish the newest version into the snap store anymore. Is there anything else I can do? The snapcraft.yaml file is in this repo: https://github.com/krillefear/fluffychat-snap

Hi, I’ve done some investigations. I believe the following PR should get you going again:

Whoa thank you so much!! I’ve tried the same but looks like I have forgotten to change the command to /bin/fluffychat and add the jq package! Thaaaaaanks <3

1 Like