Fdroid build and checksupdate failing in CI?

Hi, I am trying to get my app on fdroid. I have done the steps in the guide, but when I push to my fork, the CI for build and checksupdate fail and I have no idea why.

build CI: fdroid build (#5754804306) · Jobs · Ahsan Sarwar / fdroiddata · GitLab
checksupdate CI: checkupdates (#5754804414) · Jobs · Ahsan Sarwar / fdroiddata · GitLab

com.vicolo.chrono.yml

Categories:
  - Time
License: GPL-3.0-or-later
AuthorName: Vicolo
AuthorEmail: ahsansarwar.as45@gmail.com
SourceCode: https://github.com/vicolo-dev/chrono
IssueTracker: https://github.com/vicolo-dev/chrono/issues

AutoName: Chrono

RepoType: git
Repo: https://github.com/vicolo-dev/chrono
Binaries: https://github.com/vicolo-dev/chrono/releases/latest/download/app-arm64-v8a-release.apk

Builds:
  - versionName: 0.2.5
    versionCode: 1
    commit: v0.2.5
    output: build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
    srclibs:
      - flutter@stable
    prebuild:
      - version=$(sed -n -E "s/.*flutter-version:\ '(.*)'/\1/p" .github/workflows/android-release.yml)
      - pushd $$flutter$$
      - git checkout -f $version
      - popd
      - export PUB_CACHE=$(pwd)/.pub-cache
      - $$flutter$$/bin/flutter config --no-analytics
      - $$flutter$$/bin/flutter pub get
    scandelete:
      - .pub-cache
    build:
      - export PUB_CACHE=$(pwd)/.pub-cache
      - $$flutter$$/bin/flutter build apk --release --split-per-abi --target-platform="android-arm64"

AllowedAPKSigningKeys: 67ee2965dffd6b509ed274a3c18d39f0e5d55ebba4a95dfc1e34879f437e7581

AutoUpdateMode: Version
UpdateCheckMode: Tags ^v.*$
CurrentVersion: 0.2.5
CurrentVersionCode: 1

You need to either adjust the metadata or the build.gradle.
Versions declared in both must match.

2023-12-14 16:47:43,285 ERROR: Could not build app com.vicolo.chrono: Unexpected version/version code in output; APK: '1.0.0' / '2001', Expected: '0.2.5' / '1'

Yes, both are the same version. I am using flutter, which automatically updates the build.gradle version using the one defined in pubspec.yaml. Infact I don’t find ‘1.0.0’ or ‘2001’ written anywhere in my code.

Better revert that, use versioning only from pubspec and update the per-abi versions: https://github.com/MateusRodCosta/vidya_music/blob/dev/android/app/build.gradle#L102-L120

Those are used like that so each architecture has its own versionCode

Thanks, I got the versionCode corrected and now checksupdate is passing and am no longer getting the version difference error in build. But I am getting another error, where the supplied binary and generated apk are different. I’m guessing its due to the CI-generated apk not being signed, while the upstream apk is signed. How should I go about fixing it?

fdroid build (#5760531604) · Jobs · Ahsan Sarwar / fdroiddata · GitLab

Or maybe its due to the builds not being reproducible?
When I run:
diff -Naur <( zipinfo upstream-release.apk ) <( zipinfo fdroiddata-ci.apk ) | bat -p -l diff
I get:

--- /proc/self/fd/16    2023-12-15 17:14:50.938204705 +0500
+++ /proc/self/fd/18    2023-12-15 17:14:50.948204705 +0500
@@ -1,5 +1,5 @@
-Archive:  upstream-release.apk
-Zip file size: 10709737 bytes, number of entries: 510
+Archive:  fdroiddata-ci.apk
+Zip file size: 10661397 bytes, number of entries: 507
 -rw-rw-rw-  0.0 unx       56 b- defN 81-Jan-01 01:01 META-INF/com/android/build/gradle/app-metadata.properties
 -rw-rw-rw-  0.0 unx     1135 b- stor 81-Jan-01 01:01 assets/dexopt/baseline.prof
 -rw-rw-rw-  0.0 unx  3468800 b- defN 81-Jan-01 01:01 classes.dex
@@ -507,7 +507,4 @@
 -rw----     2.0 fat    18640 b- defN 81-Jan-01 01:01 kotlin/kotlin.kotlin_builtins
 -rw----     2.0 fat     3399 b- defN 81-Jan-01 01:01 kotlin/ranges/ranges.kotlin_builtins
 -rw----     2.0 fat     2396 b- defN 81-Jan-01 01:01 kotlin/reflect/reflect.kotlin_builtins
--rw-rw-rw-  0.0 unx    45310 b- defN 81-Jan-01 01:01 META-INF/CERT.SF
--rw-rw-rw-  0.0 unx     1371 b- defN 81-Jan-01 01:01 META-INF/CERT.RSA
--rw-rw-rw-  0.0 unx    45236 b- defN 81-Jan-01 01:01 META-INF/MANIFEST.MF
-510 files, 22663328 bytes uncompressed, 10644896 bytes compressed:  53.0%
+507 files, 22571411 bytes uncompressed, 10605218 bytes compressed:  53.0%

Which is expected, isn’t it? (since the guide mentions that these would only be in the upstream one)

But when I run:
apksigcopier compare upstream-release.apk --unsigned fdroiddata-ci.apk && echo OK
I get:

DOES NOT VERIFY
ERROR: APK Signature Scheme v2 signer #1: APK integrity check failed. CHUNKED_SHA256 digest mismatch. Expected: <9a74a77b01032085c88e02cefde24fce8ac89417d12ad02b714fc7a0b3c3db1f>, actual: <7e10ce58d745575c41592c940d8ae135c4d296742a9766bc3df2f393d0eba28c>
Error: failed to verify /tmp/tmpb4fxf_7s/output.apk.

fdroid build (#5760531604) · Jobs · Ahsan Sarwar / fdroiddata · GitLab focus on libapp.so and XML files

Let’s start with XML files, why are those different?

I can’t write to your branch but update it with:

Categories:
  - Time
License: GPL-3.0-or-later
AuthorName: Vicolo
AuthorEmail: ahsansarwar.as45@gmail.com
SourceCode: https://github.com/vicolo-dev/chrono
IssueTracker: https://github.com/vicolo-dev/chrono/issues

AutoName: Chrono

RepoType: git
Repo: https://github.com/vicolo-dev/chrono

Builds:
  - versionName: 0.2.7
    versionCode: 31
    commit: 299467f
    sudo:
      - apt-get update
      - apt-get install -y openjdk-17-jdk-headless
      - update-java-alternatives -a
      - mkdir -p /home/runner/
      - chown vagrant /home/runner/
    output: build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk
    binary: https://github.com/vicolo-dev/chrono/releases/download/v%v/app-armeabi-v7a-release.apk
    srclibs:
      - flutter@3.16.3
    prebuild:
      - version=$(sed -n -E "s/.*flutter-version:\ '(.*)'/\1/p" .github/workflows/android-release.yml)
      - pushd $$flutter$$
      - git checkout -f $version
      - popd
      - export repo=/home/runner/work/chrono
      - mkdir -p $repo
      - cd .. 
      - mv com.vicolo.chrono $repo/chrono
      - pushd $repo/chrono
      - export PUB_CACHE=$(pwd)/.pub-cache
      - $$flutter$$/bin/flutter config --no-analytics
      - $$flutter$$/bin/flutter pub get
      - popd
      - mv $repo/chrono com.vicolo.chrono
    scandelete:
      - .pub-cache
    build:
      - export repo=/home/runner/work/chrono
      - cd .. 
      - mv com.vicolo.chrono $repo/chrono
      - pushd $repo/chrono
      - export PUB_CACHE=$(pwd)/.pub-cache
      - $$flutter$$/bin/flutter build apk --release --split-per-abi --target-platform="android-arm"
      - popd
      - mv $repo/chrono com.vicolo.chrono
      - cd om.vicolo.chrono

  - versionName: 0.2.7
    versionCode: 32
    commit: 299467f
    sudo:
      - apt-get update
      - apt-get install -y openjdk-17-jdk-headless
      - update-java-alternatives -a
      - mkdir -p /home/runner/
      - chown vagrant /home/runner/
    output: build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
    binary: https://github.com/vicolo-dev/chrono/releases/download/v%v/app-arm64-v8a-release.apk
    srclibs:
      - flutter@3.16.3
    prebuild:
      - version=$(sed -n -E "s/.*flutter-version:\ '(.*)'/\1/p" .github/workflows/android-release.yml)
      - pushd $$flutter$$
      - git checkout -f $version
      - popd
      - export repo=/home/runner/work/chrono
      - mkdir -p $repo
      - cd .. 
      - mv com.vicolo.chrono $repo/chrono
      - pushd $repo/chrono
      - export PUB_CACHE=$(pwd)/.pub-cache
      - $$flutter$$/bin/flutter config --no-analytics
      - $$flutter$$/bin/flutter pub get
      - popd
      - mv $repo/chrono com.vicolo.chrono
    scandelete:
      - .pub-cache
    build:
      - export repo=/home/runner/work/chrono
      - cd .. 
      - mv com.vicolo.chrono $repo/chrono
      - pushd $repo/chrono
      - export PUB_CACHE=$(pwd)/.pub-cache
      - $$flutter$$/bin/flutter build apk --release --split-per-abi --target-platform="android-arm64"
      - popd
      - mv $repo/chrono com.vicolo.chrono
      - cd om.vicolo.chrono

  - versionName: 0.2.7
    versionCode: 33
    commit: 299467f
    sudo:
      - apt-get update
      - apt-get install -y openjdk-17-jdk-headless
      - update-java-alternatives -a
      - mkdir -p /home/runner/
      - chown vagrant /home/runner/
    output: build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
    binary: https://github.com/vicolo-dev/chrono/releases/download/v%v/app-x86_64-release.apk
    srclibs:
      - flutter@3.16.3
    prebuild:
      - version=$(sed -n -E "s/.*flutter-version:\ '(.*)'/\1/p" .github/workflows/android-release.yml)
      - pushd $$flutter$$
      - git checkout -f $version
      - popd
      - export repo=/home/runner/work/chrono
      - mkdir -p $repo
      - cd .. 
      - mv com.vicolo.chrono $repo/chrono
      - pushd $repo/chrono
      - export PUB_CACHE=$(pwd)/.pub-cache
      - $$flutter$$/bin/flutter config --no-analytics
      - $$flutter$$/bin/flutter pub get
      - popd
      - mv $repo/chrono com.vicolo.chrono
    scandelete:
      - .pub-cache
    build:
      - export repo=/home/runner/work/chrono
      - cd .. 
      - mv com.vicolo.chrono $repo/chrono
      - pushd $repo/chrono
      - export PUB_CACHE=$(pwd)/.pub-cache
      - $$flutter$$/bin/flutter build apk --release --split-per-abi --target-platform="android-x64"
      - popd
      - mv $repo/chrono com.vicolo.chrono
      - cd om.vicolo.chrono

AllowedAPKSigningKeys: 67ee2965dffd6b509ed274a3c18d39f0e5d55ebba4a95dfc1e34879f437e7581

AutoUpdateMode: Version
UpdateCheckMode: Tags
VercodeOperation:
  - 10 * %c + 1
  - 10 * %c + 2
  - 10 * %c + 3
UpdateCheckData: pubspec.yaml|version:\s.+\+(\d+)|.|version:\s(.+)\+
CurrentVersion: 0.2.7
CurrentVersionCode: 33

Did so. Its still failing though.

fdroid build (#5762477095) · Jobs · Ahsan Sarwar / fdroiddata · GitLab

yes, but notice that libapp.so aka your app code does not :slight_smile:

(sorry for the typo lol)

compared APKs locally and they seem repro, do open a proper Merge Request so we can test better

Ahh, thank you.

Created the merge request: com.vicolo.chrono (!14190) · Merge requests · F-Droid / Data · GitLab

  • You should remove the AllowedAPKSigningKeys field, as F-Droid will sign your app with its own key. This field is only used for apps that are already signed by another source and need to be verified by F-Droid.

Currently, I am also releasing the apks on github release, which are signed by myself. So I need this field, no?

As I said the app appears to be “reproducible” so if it is… that line is NEEDed :wink: Inclusion How-To | F-Droid - Free and Open Source Android App Repository

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.