Flutter app and signing

I have an app that I want to add to F-Droid. It’s a Dart/Flutter app.

Flutter’s way of handle Playstore singing process is adding singing configuration to build.gradle file: https://docs.flutter.dev/deployment/android#sign-the-app.

Can I adapt my build files to work with both Playstore and F-Droid? What changes I need make to F-Droid singing process work?

Many thanks.

Generally you don’t need to do anything.

Are you sure? Currently Android build depends on keystore.properties file. This file holds key store location, key alias and passwords. It is not checked into source control. Release build will fail if gradle can’t find this file.

We don’t use your key. We either sign it with our own key or use your signed apk for reproducible build.

So I need to remove singing config from build.gradle.kts. I’ve just found this answer on an another thread: https://forum.f-droid.org/t/need-a-hand-for-apk-signing/30503/

Remove all the keystore entries so it does not try

sed -i -e '/signingConfigs {/,/^ }/d' build.gradle.in

This solution applies to my case as well, right? Although I need expand that to remove all parts that depends on the existence of the properties file.

Yes, that’s needed.

I moved file import part inside of the singingConfigs block. Now running

sed -i -e '/signingConfigs {/,/^ }/d' -e '/signingConfig =/d' ./android/app/build.gradle.kts

removes all the relevant parts.

Thanks :slight_smile:

A follow up:

Turns out that sed command is unnecessary. The first response linsui posted was indeed correct: You don’t need to remove signing config yourself, F-Droid tooling handles that. Just make sure your build doesn’t outright crash if it can’t find key.properties file.