How to Publish Your Flutter App With Flavors on F-Droid?

F-Droid is an installable catalog of FOSS (Free and Open Source Software) applications for the Android platform. The client makes it easy to browse, install, and keep track of updates on your device. F-Droid website

All the steps from this tutorial will work for an app without flavors as well.


Which apps can be included to F-Droid?

The app can be included in F-Droid only if it is completely open-source - including all libraries and dependencies used. Learn more about the inclusion policy here.

For example, if you use ObjectBox database in your app, it can't be included in F-Droid (discussion).


Step 1

  • Fork fdroiddata repository on Gitlab.
  • Clone the repository to your device.
  • Create a branch with the bundle ID of the app, for example co.localmonero.app

Step 2

Check that fdroid works correctly. Run the following commands in your fdroid folder:

fdroid init
fdroid readmeta

Step 3

Add your project:

fdroid import --url https://github.com/YOUR_REPO --subdir app

It will create a file in the metadata directory, for example metadata/co.localmonero.app.yml. You can also create this file manually.


Step 4

Open the file and edit it. Here's an example: https://gitlab.com/fdroid/fdroiddata/-/blob/master/metadata/co.localmonero.app.yml.

In the example you can see:

  1. Flutter is used as a submodule - this is a requirement from the F-Droid team.
  2. For every flavor we've used a separate branch (command AutoUpdateMode: Version %v-fdroid-lm). That's because Fastlane doesn't support flavors with Flutter.
  3. First time we add build info manually, in the future it will be added automatically by a bot, after we push a new tag.

Check that the file has correct syntax: fdroid readmeta.


Step 5

Now, let's add data for the F-Droid market. For that we create a separate branch for each flavor:

After that, we create a folder for Fastlane: https://github.com/AgoraDesk-LocalMonero/agoradesk-app-foss/tree/fdroid_ad/fastlane/metadata/android/en-US.

Add the required data and push it.


Step 6

It is time to add the app to F-Droid.

  1. Create a tag in your app repository.
  2. Push changes to the F-Droid repository on Gitlab.
  3. Make a merge request in the Gitlab repo. Use id of your app in the title.
  4. Wait for a review from the F-Droid team.

Conclusion

The process is a little bit complicated and different issues may arise along the way. But once you set up the CI, the following updates will be handled automatically.

In case you have questions, feel free to ask them on our GitHub.