Giter Club home page Giter Club logo

flutter_flatpak_example's Introduction

Flutter Flatpak Example

An example of how to package a Flutter application as a Flatpak for distribution on Linux, using the default counter example app.

Flatpak documentation

Requirements

Note: Building a flatpak should be done in a predictable environment or it may fail.

Set up Flathub, and choose one:

VSCode dev container

Use the VSCode dev container provided in this repo that will run everything through Docker

  1. Install the Dev Containers extension

  2. Open this directory in VSCode.

  3. Accept the prompt to re-open in the dev container, or from the Command Palette search for Reopen in Container

GitHub actions

There is a GitHub action for this purpose, which is demonstrated in this repo. This action's page also lists the docker containers it uses.

If you fork this example repo you can run the example workflow, and install the .flatpak file it generates with flatpak install <path-to-.flatpak>.

Manual Requirements

Install flatpak and flatpak-builder

On ubuntu:

sudo apt install flatpak flatpak-builder

Add the FlatHub repo:

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Install flatpak build dependencies:

flatpak install -y org.freedesktop.Sdk/x86_64/22.08
flatpak install -y org.freedesktop.Platform/x86_64/22.08
flatpak install -y flathub org.freedesktop.appstream-glib

Instructions

We have two directories that each represent what would be separate git repositories for a real project:

counter_app is the Flutter app, view the README there for info on configuration and building.

flathub_repo is separate from the Flutter app and is where the Flatpak is assembled, view the README there for info on configuration, building, and publishing of the flatpak after building the counter_app.

flutter_flatpak_example's People

Contributors

merrit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

flutter_flatpak_example's Issues

tar command is wrong

tar -C build/linux/x64/release/bundle -cvf FlutterApp-Linux-Portable.tar.gz .

need to add an 'a' argument. The file ends in gz, but without that a, it will be a tar file.

error: org.freedesktop.Sdk/x86_64/21.08 not installed

instructions don't work.

$ flatpak-builder --force-clean build-dir com.example.FlutterApp.json
error: org.freedesktop.Sdk/x86_64/21.08 not installed
Failed to init: Unable to find sdk org.freedesktop.Sdk version 21.08

Error while launching the app

Hi, and thank for this tutorial!
I followed your steps on multiple machines (even with different distros)
But when I try to install the app with

flatpak-builder --user --install --force-clean build-dir com.example.FlutterApp.json

and then launching it with flatpak run com.example.FlutterApp

I get the following error:

FlutterApp: /usr/lib/x86_64-linux-gnu/libc.so.6: version 'GLIBC_2.34' not found (required by FlutterApp)

aarch64

When I look at the code, I wonder how to build an arm build of the flutter app.

cd build/linux/x64/release/bundle || exit

This example seems to be only x64. Do I read that right?
The flatpack action allows building for both platforms. I will have a look on how to achieve this.

It seems easy to me:

  • build both architectures
  • create an archive for both architectures
  • submit a build for these

Something I need to figure out: Is there a way in the manifest to download a different archive depending on the build architecture?

See also:

[Questions] Help automating with GitHub Actions

Hi,

Thanks for creating this project, it's been very useful! I've run into a few questions setting it up through GitHub Actions and was hoping you'd be able to help.

  • How are you adding FlutterApp-Linux-Portable.tar.gz to the release, are you manually downloading it and then attaching it? If it's currently manual I assume we could use a upload-release-asset action to automate it?

  • How do you suggest handling the flatpak.yml workflow file when using two repos. Should the entire action run on the code repo or would it make more sense to run the build-flatpak job on the flathub repo? What's unclear is I don't see how FlutterApp.flatpak is used in the action, or is it just to test manually?

Hope you don't mind me creating an issue for questions.

Cheers

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.