Flutter build fails - CMake Error at flutter/generated_plugins.cmake:12 (add_subdirectory)

I can run ‘snapcraft’ and everything is fine. When I try to create the package again, it fails with the error below. I then have to run ‘snapcraft clean’

Any suggestions?

[  +22 ms] executing: [build/linux/x64/release/] cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DFLUTTER_TARGET_PLATFORM=linux-x64 /root/parts/dotup-app/build/linux
[  +43 ms] CMake Error at flutter/generated_plugins.cmake:12 (add_subdirectory):
[   +1 ms]   add_subdirectory given source
[        ]   "flutter/ephemeral/.plugin_symlinks/url_launcher_linux/linux" which is not
[        ]   an existing directory.
[        ] Call Stack (most recent call first):
[        ]   CMakeLists.txt:69 (include)
[        ] -- Configuring incomplete, errors occurred!
[        ] See also "/root/parts/dotup-app/build/build/linux/x64/release/CMakeFiles/CMakeOutput.log".
[  +21 ms] Building Linux application... (completed in 80ms)
[        ] "flutter linux" took 675ms.
[   +5 ms] Unable to generate build files
[        ] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      _runCmake (package:flutter_tools/src/linux/build_linux.dart:155:5)
           <asynchronous suspension>
           #2      buildLinux (package:flutter_tools/src/linux/build_linux.dart:75:5)
           <asynchronous suspension>
           #3      BuildLinuxCommand.runCommand (package:flutter_tools/src/commands/build_linux.dart:88:5)
           <asynchronous suspension>
           #4      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1130: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:288: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:236: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:92:3)
           <asynchronous suspension>
           
           
[ +131 ms] ensureAnalyticsSent: 127ms
[   +1 ms] Running shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 1
Failed to run 'flutter build linux --release -v -t lib/main.dart' for 'dotup-app': 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.

can you edit your post and place three backticks (```) above and below the output so that line breaks are preserved? That might help others to read it easily.

1 Like

In your terminal run flutter clean and then snapcraft clean build the project again.