Build and release a Linux app

During a typical development cycle, you test an app using flutter run at the command line, or by using the Run and Debug options in your IDE. By default, Flutter builds a debug version of your app.

When you’re ready to prepare a release version of your app, for example to publish to the Snap Store, this page can help.


To build and publish to the Snap Store, you need the following components:

Set up the build environment

Use the following instructions to set up your build environment.

Install snapcraft

At the command line, run the following:

$ sudo snap install snapcraft --classic

Install Multipass

Also at the command line, run the following:

$ sudo snap install multipass --classic

To work correctly, Multipass requires access to the CPU virtualization extensions. If the extensions are not available for your CPU architecture, not enabled in BIOS, or not accessible (for instance if you are running a virtual machine without nested virtualization), you won’t be able to use Multipass.

If you see the following error, you should use LXD:

launch failed: CPU does not support KVM extensions

Install LXD

To install LXD, use the following command:

$ sudo snap install lxd

LXD can be used as an alternative backend during the snap build process. Once installed, LXD needs to be configured for use. The default answers are suitable for most use cases.

$ sudo lxd init
Would you like to use LXD clustering? (yes/no) [default=no]:
Do you want to configure a new storage pool? (yes/no) [default=yes]:
Name of the new storage pool [default=default]:
Name of the storage backend to use (btrfs, dir, lvm, zfs, ceph) [default=zfs]:
Create a new ZFS pool? (yes/no) [default=yes]:
Would you like to use an existing empty disk or partition? (yes/no) [default=no]:
Size in GB of the new loop device (1GB minimum) [default=5GB]:
Would you like to connect to a MAAS server? (yes/no) [default=no]:
Would you like to create a new local network bridge? (yes/no) [default=yes]:
What should the new bridge be called? [default=lxdbr0]:
What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]:
What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]:
Would you like LXD to be available over the network? (yes/no) [default=no]:
Would you like stale cached images to be updated automatically? (yes/no) [default=yes]
Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]:

On the first run, LXD may not be able to connect to its socket:

An error occurred when trying to communicate with the 'LXD'
provider: cannot connect to the LXD socket

This means you need to add your user name to the LXD (lxd) group, so log out of your session and then log back in:

$ sudo usermod -a -G lxd <your username>

Overview of snapcraft

The snapcraft tool builds snaps based on the instructions listed in a snapcraft.yaml file. To get a basic understanding of snapcraft and its core concepts, take a look at the Snap documentation and the Introduction to snapcraft. Additional links and information are listed at the bottom of this page.

Flutter snapcraft.yaml example

Place the YAML file in your Flutter project under <project root>/snap/snapcraft.yaml. (And remember that YAML files are sensitive to white space!) For example:

name: super-cool-app
version: 0.1.0
summary: Super Cool App
description: Super Cool App that does everything!

confinement: strict
base: core18
grade: stable

    command: super_cool_app
    extensions: [flutter-master] # Where "master" defines which Flutter channel to use for the build
    - network

    source: .
    plugin: flutter
    flutter-target: lib/main.dart # The main entry-point file of the application

The following sections explain the various pieces of the YAML file.


This section of the snapcraft.yaml file defines and describes the application. The snap version is derived (adopted) from the build section.

name: super-cool-app
version: 0.1.0
summary: Super Cool App
description: Super Cool App that does everything!

Grade, confinement, and base

This section defines how the snap is built.

confinement: strict
base: core18
grade: stable
Specifies the quality of the snap; this is relevant for the publication step later.
Specifies what level of system resource access the snap will have once installed on the end-user system. Strict confinement limits the application access to specific resources (defined by plugs in the app section).
Snaps are designed to be self-contained applications, and therefore, they require their own private core root filesystem known as base. The base keyword specifies the version used to provide the minimal set of common libraries, and mounted as the root filesystem for the application at runtime.


This section defines the application(s) that exist inside the snap. There can be one or more applications per snap. This example has a single application—super_cool_app.

    command: super_cool_app
    extensions: [flutter-master]
Points to the binary, relative to the snap’s root, and runs when the snap is invoked.
A list of one or more extensions. Snapcraft extensions are reusable components that can expose sets of libraries and tools to a snap at build and runtime, without the developer needing to have specific knowledge of included frameworks. The flutter-master extension exposes the GTK 3 libraries to the Flutter snap. This ensures a smaller footprint and better integration with the system.

The flutter-master extension sets your flutter channel to master. If you would like to build your app with the dev channel simply use the flutter-dev extension.

A list of one or more plugs for system interfaces. These are required to provide necessary functionality when snaps are strictly confined. This Flutter snap needs access to the network.


This section defines the sources required to assemble the snap.

Parts can be downloaded and built automatically using plugins. Similar to extensions, snapcraft can use various plugins (like Python, C, Java, Ruby, etc) to assist in the building process. Snapcraft also has some special plugins.

nil plugin
Performs no action and the actual build process is handled using a manual override.
flutter plugin
Provides the necessary Flutter SDK tools so you can use it without having to manually download and set up the build tools.
    source: .
    plugin: flutter
    flutter-target: lib/main.dart # The main entry-point file of the application

Build the snap

Once the snapcraft.yaml file is complete, run snapcraft as follows from the root directory of the project.

To use the Multipass VM backend:

$ snapcraft

To use the LXD container backend:

$ snapcraft --use-lxd


Once the snap is built, you’ll have a <name>.snap file in your root project directory. You can now publish the snap. The process consists of the following:

  1. Create a developer account at, if you haven’t already done so.
  2. Register the app’s name. Registration can be done either using the Snap Store Web UI portal, or from the command line, as follows:
    $ snapcraft login
    $ snapcraft register
  3. Release the app. After reading the next section to learn about selecting a Snap Store channel, push the snap to the store:
    $ snapcraft push --release=<channel> <file>.snap

Snap Store channels

The Snap Store uses channels to differentiate among different versions of snaps.

The snapcraft push command uploads the snap file to the store. However, before you run this command, you need to learn about the different release channels. Each channel consists of three components:

All snaps must have a default track called latest. This is the implied track unless specified otherwise.
Defines the readiness of the application. The risk levels used in the snap store are: stable, candidate, beta, and edge.
Allows creation of short-lived snap sequences to test bug-fixes.

Snap Store automatic review

The Snap Store runs several automated checks against your snap. There may also be a manual review, depending on how the snap was built, and if there are any specific security concerns. If the checks pass without errors, the snap becomes available in the store.

Additional resources

You can learn more from the following links on the site: