Are you also lost or stuck and don't know how to publish your app to F-droid
for the first time. You came to right place, this guide will show you how to
publish your app to F-droid with all the details needed. If you have any doubt
or queries then please ask in comments.
Step 1: Fork official fdroiddata repo
Fork official fdroiddata repo - https://gitlab.com/fdroid/fdroiddata/-/tree/master. Once you fork then you have to clone the forked repo created under your
username.
Clone git repo
git clone https://gitlab.com/<your-username>/fdroiddata
cd fdroiddata
I would suggest you to run fdroid under python environment since it needs some
python packages to run. It's better to not mess up your existing python
installation and bulk it up with fdroid dependencies. Here is an official
documentation on how to create venvs - https://docs.python.org/3/library/venv.html. Run below commands under python activated environment and install missing
packages.
I had conda installed already. I am attaching my requirements.txt from conda that
you can install using command
Conda env creation
conda create --name <env> --file requirements.txt
Requirements.txt
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: osx-arm64
androguard=3.3.5=pypi_0
appnope=0.1.3=pypi_0
asn1crypto=1.5.1=pypi_0
asttokens=2.0.8=pypi_0
backcall=0.2.0=pypi_0
brotlipy=0.7.0=py39hb18efdd_1004
ca-certificates=2022.6.15=h4653dfc_0
certifi=2022.6.15=py39h2804cbe_0
cffi=1.15.1=py39h04d3946_0
charset-normalizer=2.1.0=pyhd8ed1ab_0
click=8.1.3=pypi_0
colorama=0.4.5=pypi_0
cryptography=37.0.4=py39h4cb6239_0
cycler=0.11.0=pypi_0
decorator=5.1.1=pypi_0
executing=0.10.0=pypi_0
fonttools=4.35.0=pypi_0
freetype=2.10.4=hd633e50_2
future=0.18.2=pypi_0
gitdb=4.0.9=pypi_0
gitpython=3.1.27=pypi_0
idna=3.3=pyhd8ed1ab_0
ipython=8.4.0=pypi_0
jedi=0.18.1=pypi_0
jpeg=9e=he4db4b2_2
kiwisolver=1.4.4=pypi_0
lcms2=2.12=had6a04f_0
lerc=4.0.0=h9a09cb3_0
libcxx=14.0.6=h04bba0f_0
libdeflate=1.13=h57fd34a_0
libffi=3.4.2=h3422bc3_5
libpng=1.6.37=h9b2ccdc_4
libsqlite=3.39.2=h2c9beb0_1
libtiff=4.4.0=hd6ca8d7_3
libwebp-base=1.2.4=h57fd34a_0
libxcb=1.13=h9b22ae9_1004
libzlib=1.2.12=ha287fd2_2
lxml=4.9.1=pypi_0
lz4-c=1.9.3=hbdafb3b_1
matplotlib=3.5.3=pypi_0
matplotlib-inline=0.1.3=pypi_0
ncurses=6.3=h07bb92c_1
networkx=2.8.5=pypi_0
numpy=1.23.2=pypi_0
openjpeg=2.5.0=h5d4e404_1
openssl=1.1.1q=ha287fd2_0
packaging=21.3=pypi_0
parso=0.8.3=pypi_0
pexpect=4.8.0=pypi_0
pickleshare=0.7.5=pypi_0
pillow=9.2.0=py39he45c975_2
pip=22.2.2=pyhd8ed1ab_0
prompt-toolkit=3.0.30=pypi_0
pthread-stubs=0.4=h27ca646_1001
ptyprocess=0.7.0=pypi_0
pure-eval=0.2.2=pypi_0
pyasn1=0.4.8=pypi_0
pyasn1-modules=0.2.8=pypi_0
pycparser=2.21=pyhd8ed1ab_0
pydot=1.4.2=pypi_0
pygments=2.13.0=pypi_0
pyopenssl=22.0.0=pyhd8ed1ab_0
pyparsing=3.0.9=pypi_0
pysocks=1.7.1=py39h2804cbe_5
python=3.9.7=h54d631c_3_cpython
python-dateutil=2.8.2=pypi_0
python_abi=3.9=2_cp39
pyyaml=6.0=pypi_0
qrcode=7.3.1=pypi_0
readline=8.1.2=h46ed386_0
requests=2.28.1=pyhd8ed1ab_0
ruamel=1.0=py39h2804cbe_6
ruamel.yaml=0.17.21=py39hb18efdd_1
ruamel.yaml.clib=0.2.6=py39hb18efdd_1
setuptools=65.0.0=py39h2804cbe_0
six=1.16.0=pypi_0
smmap=5.0.0=pypi_0
sqlite=3.39.2=h40dfcc0_1
stack-data=0.4.0=pypi_0
tk=8.6.12=he1e0b03_0
traitlets=5.3.0=pypi_0
tzdata=2022b=h191b570_0
urllib3=1.26.11=pyhd8ed1ab_0
wcwidth=0.2.5=pypi_0
wheel=0.37.1=pyhd8ed1ab_0
xorg-libxau=1.0.9=h27ca646_0
xorg-libxdmcp=1.1.3=h27ca646_0
xz=5.2.6=h57fd34a_0
zlib=1.2.12=ha287fd2_2
zstd=1.5.2=h68b4297_4
Step 2 : Initialize fdroid
Make sure you have already activated python or conda environment already and
you are inside fdroiddata repository before running below commands.
Initialize F-droid
fdroid init
fdroid readmeta
Step 3: Add flavor for fdroid in app.gradle
You can create a separate flavour for fdroid or use your existing apk to
publish it on fdroid. You can check out here example for vernet's
build.gradle.
android/app/build.gradle
productFlavors { fdroid { dimension "deploy" signingConfig signingConfigs.release } }
Step 4 : Build your apk (optional)
Adding flavor flag is optional if you didn't add above code.
Run below command inside flutter project
flutter build apk --flavor fdroid
Make sure that above command succeeds because same command we will provide in
our yml configuration.
Step 5: Import code from your project repository
Import repo code in fdroid
fdroid import --url <your-git-repo-url>
Create a yml file under fdroiddata/metadata folder with name as your app's
applicationId or namespace. Take
example
for vernet
namespace "org.fsociety.vernet"
Open any code editor to edit this file. I used visual studio code to open this
file with below command.
Open yml file
open metadata/org.fsociety.vernet.yml
I have provided example below, you can copy paste and change it accordingly
e.g., version, license, category, remove gradle, subdir, and commit, etc.
org.fsociety.vernet.yml
Categories:
- Connectivity
- Internet
- Security
License: Apache-2.0
SourceCode: https://github.com/git-elliot/vernet
IssueTracker: https://github.com/git-elliot/vernet/issues
AutoName: Vernet
RepoType: git
Repo: https://github.com/git-elliot/vernet
Builds:
- versionName: 1.0.0
versionCode: 2
commit: v1.0.0+2
output: build/app/outputs/flutter-apk/app-fdroid-release.apk
srclibs:
- flutter@2.2.1
build:
- $$flutter$$/bin/flutter config --no-analytics
- $$flutter$$/bin/flutter packages pub get
- $$flutter$$/bin/flutter build apk --flavor fdroid
AutoUpdateMode: Version v%v+%c
UpdateCheckMode: Tags
UpdateCheckData: pubspec.yaml|version:\s.*\+(\d+)|.|version:\s.*\+
CurrentVersion: 1.0.0
CurrentVersionCode: 2
#new line required at the end of file
Step 6: Update metadata in fdroid and build it.
F-droid scripts
fdroid rewritemeta org.fsociety.vernet
fdroid readmeta
fdroid lint org.fsociety.vernet
fdroid build -v -l org.fsociety.vernet # runs only once for each tag
If any of the above step fails, please fix it and try again. You need to
rewritemeta again if you change yml configuration and readmeta again. Usually
lint and build will fail and because of that you need to run these above 4
commands again and again.
Step 7: Creating a merge request
Once you have built your app using fdroid successfully then you are ready the
create merge request on fdroiddata gitlab repository.
F-droid scripts
git checkout -b org.fsociety.vernet
git add metadata/org.fsociety.vernet.yml
git commit -m "New App: org.fsociety.vernet"
git push origin org.fsociety.vernet
Now wait for pipeline to pass in your merge request. If pipeline fails then
update the yml configuration accordingly and commit again. There will be
authors and contributors that will help you in passing pipeline by suggesting
yml fixes.
Here is the example file in fdroiddata repo for vernet - https://gitlab.com/fdroid/fdroiddata/-/blob/master/metadata/org.fsociety.vernet.yml
Fastlane directory and metadata information can be found in repository
- https://github.com/osociety/vernet
No comments:
Post a Comment
Please write your query here in comments so that it can benefit everyone reading this blog.