Run Flutter Applications on Ubuntu Core

i’d do that type of detection at runtime instead of build time:

    plugin: nil
    override-build: |
      snapcraftctl build
      mkdir -p $SNAPCRAFT_PART_INSTALL/bin/
      echo 'case $(arch) in aarch64|armv7l) export GDK_GL=gles;; esac' > $SNAPCRAFT_PART_INSTALL/bin/gl-launch
      echo 'exec "$@"' >> $SNAPCRAFT_PART_INSTALL/bin/gl-launch
      chmod a+x $SNAPCRAFT_PART_INSTALL/bin/gl-launch

:+1: new snapcraft.yaml in the tutorial works fine for both amd64/arm64. :grin:

1 Like

There are many equivalent ways to do this. :man_shrugging:

Hi, I’m trying to run this example in a raspberry pi 4 using ubuntu core 20, but after install ubuntu-frame and the super-cool-app snap, I only get the grey wallpaper from ubuntu-frame but no signal of the flutter app.

I added this to the snapcraft.yaml file to make the snap compatible with armhf architercture:

    - build-on: amd64
      run-on: armhf

Also, when I run super-cool-app on the command line, I get this messages:

error: error running snapctl: snap "super-cool-app" has no plug or slot named "pulseaudio"

WARNING: pulseaudio interface not connected! Please run: /snap/super-cool-app/current/bin/

/snap/super-cool-app/x2/bin/wayland-launch: 22: /snap/super-cool-app/x2/bin/wayland-launch: inotifywait: Exec format error

Any help will be very appreciated.

This does not do what you think it does. It builds and packages amd64 binaries and attempts to run them on armhf. (Spoiler alert: amd64 binaries are unsuitable for armhf.)

IIRC the Flutter toolchain supports amd64 and arm64 but not armhf.

There’s a good guide to developing GUI apps for Core here:

And there’s a corresponding Flutter-demo branch in

Good luck!

1 Like

Hi all,

I followed this guide and my application run correctly but not work the on screen keyboard. I used ubuntu-frame-osk. You have a suggest to fix this?

Hi @rickypid, I think this tutorial was written before the OSK was introduced and hasn’t yet been updated.

The first question to answer is whether Flutter supports zwp_text_input_v2 or zwp_text_input_v3. I don’t know the answer, so probably the easiest way to test this is try running your application without snap packaging as described in the first part of:

(Obviously you will also need to start the OSK in the testing environment for it to work.)

That will help identify where the problem lies.


The OSK does work with Flutter. Here’s an example:

1 Like

@alan_g Thanks for the quick reply,

I have run various tests and the OSK configuration seems to work but not on flutter applications, I try to follow the example you linked me.

I try to buil a snap with your example and recieived this error during install:

error: cannot perform the following tasks:
- Run install hook of "iot-example-graphical-snap" snap if present (run hook "install": cannot snap-exec: no such file or directory)

:man_shrugging: I can’t reproduce that error.

$ git clone
Cloning into 'iot-example-graphical-snap'...
remote: Enumerating objects: 134, done.
remote: Counting objects: 100% (83/83), done.
remote: Compressing objects: 100% (63/63), done.
remote: Total 134 (delta 21), reused 73 (delta 12), pack-reused 51
Receiving objects: 100% (134/134), 35.70 KiB | 5.10 MiB/s, done.
Resolving deltas: 100% (33/33), done.
$ cd iot-example-graphical-snap/
$ git checkout Flutter-demo
Branch 'Flutter-demo' set up to track remote branch 'Flutter-demo' from 'origin'.
Switched to a new branch 'Flutter-demo'
$ snapcraft && snap install --dangerous *.snap
Snapped iot-example-graphical-snap_0+git.bc3a718_amd64.snap
iot-example-graphical-snap 0+git.bc3a718 installed
1 Like

I have build a snap with:

snapcraft --use-lxd

That won’t make any difference when installing the snap.

Hi @alan_g,

thanks for your support, i have rebooted machine and rebuild, inistalled and run snap succesfully.
Now the ODK works correctly.

In your example you have this directory structure:


I need modify structure in my project:


what needs to be changed in the snapcraft.yaml file?

i have modify this:

    plugin: nil
    source: flutterdemo
      - flutter/latest/stable


    plugin: nil
    source: .
      - flutter/latest/stable

Thanks for your time. :innocent:

Hi, I have the same issue. But I use RPI 4 2gb, Ubuntu Core 20.

After installing nothing happens and when i try to run super-cool-app I get this:

/snap/super-cool-app/x2/bin/wayland-launch: 22: /snap/super-cool-app/x2/bin/wayland-launch: inotifywait: Exec format error

In snapcraft.yaml

    - build-on: amd64
      run-on: arm64

I have the same answer. :slight_smile:

But when I remove architecture section a build the snap, transfer to rpi then I got

cannot install snap file: snap "super-cool-app" supported architectures (amd64) are
       incompatible with this system (arm64)

So should I build the snap on the raspberry?

See the developer guide linked above:

Hi @alan_g,

I did a lot of tests, keeping the folder structure you proposed in the example, simply replacing the flutter application folder with my application . The build succeeds but during the installation I always get the same error:

error: cannot perform the following tasks:
- Run install hook of "iot-example-graphical-snap" snap if present (run hook "install": cannot snap-exec: no such file or directory)

Do you have any idea what it could be?

I have searched several forms and done many tests but without success.

Thanks you.

That error isn’t very helpful in identifying what is missing. I’ve a vague memory of someone saying a reboot helped, but don’t have that to hand. Nor do I know why that would work.

You could also unpack the .snap with unsquashfs to see if the install script is corrupted.

Thanks for reply @alan_g,

I have unpack .snap with unsquashfs, the install hooks it’s ok:

$ cat squashfs-root/snap/hooks/install 
set -x

if [ "$(snapctl get daemon)" = "" ]
  if grep -q -e snap_core= -e snapd_recovery_mode= /proc/cmdline
  then snapctl set daemon=true
  else snapctl set daemon=false

Thanks you.