Open-notes icon indicating copy to clipboard operation
Open-notes copied to clipboard

Reproducible Build fails for v1.3.9

Open IzzySoft opened this issue 5 months ago • 6 comments

First, there are now 2 APKs resulting from assembleRelease. As the release is named -fdroid, I assume the fdroid APK should be the one matching the APK attached to your release. But, the one our build produces, does not match yours:

  -rw-r--r--  0.0 unx      120 b-      118 defN 1981-01-01 01:01:02 2f9cff5c META-INF/version-control-info.textproto
- -rw-r--r--  0.0 unx     6641 b-     6641 stor 1981-01-01 01:01:02 64a42ae2 assets/dexopt/baseline.prof
+ -rw-r--r--  0.0 unx     6641 b-     6641 stor 1981-01-01 01:01:02 c2799046 assets/dexopt/baseline.prof
  -rw-r--r--  0.0 unx      787 b-      787 stor 1981-01-01 01:01:02 8a5791d8 assets/dexopt/baseline.profm
- -rw-r--r--  0.0 unx  4865412 b-  2374808 defN 1981-01-01 01:01:02 851a625b classes.dex
+ -rw-r--r--  0.0 unx  4865376 b-  2374702 defN 1981-01-01 01:01:02 425afd9f classes.dex
  -rw-r--r--  0.0 unx    10096 b-    10096 stor 1981-01-01 01:01:02 9734baa0 lib/arm64-v8a/libandroidx.graphics.path.so

The diff of classes.dex looks like it was either built with a different JDK (your GitHub Action still says 17, and that's also what we used) – or was a "dirty build" (i.e. one with uncommitted changes or artifacts from prior runs in the build tree).

Can you tell us which it is? Did you maybe build this locally on your machine, in a "dirty tree"? Or what has changed in the build process that we need to adjust at our end?

diff.zip

IzzySoft avatar Jun 25 '26 20:06 IzzySoft

Hey, Thanks for looking into this, I built the apk locally on my machine and didn't do a clean build beforehand, which caused this difference. I tested it again by doing a clean build now and it matches yours perfectly. Should I replace the apk file?

Fandroid745 avatar Jun 26 '26 02:06 Fandroid745

I tested it again by doing a clean build now and it matches yours perfectly.

Thanks for checking, fixing, and confirming! If you're on Linux (or Mac), I can offer you a little script to help avoiding such "dirty builds" in the future:

cd $project_dir
if [[ $(git status --porcelain | wc -l) -ne 0 ]]; then
  >&2 echo "ERROR! Tree is dirty, aborting build."
  exit 1
fi

./gradlew clean assembleRelease

Make sure to replace $project_dir with the directory your code resides (and the APK is built in). Short explanation:

  • the first block will abort the script if there are uncommitted changes. The "ERROR" message will be sent to STDERR (>&2).
  • the clean in the gradlew call will make sure no old artifacts are used for the build.

Should I replace the apk file?

Never replace what was already distributed. Please rather make a new release.

IzzySoft avatar Jun 26 '26 15:06 IzzySoft

I use Linux, Thanks for the script, I will create a new release.

Fandroid745 avatar Jun 26 '26 16:06 Fandroid745

Thanks! And please let me know how that script worked for you. I didn't test it myself, as I have no local development setup – but I use similar "is-it-clean" checks in several other scripts. Feel free to adapt it to your own liking 😉

IzzySoft avatar Jun 26 '26 21:06 IzzySoft

The script worked but I had to change it to assembleFdroidRelease and then later I appiled my signing key.

Fandroid745 avatar Jun 27 '26 02:06 Fandroid745

Thanks! And yes, that command needs to be adjusted when using flavors. Good point: me, stating that for the path, but omitting it for the build command, is not really consistent 🙈 Will update my notes 👍

Edit: done:

Make sure to replace $project_dir with the directory your code resides (and the APK is built in) – and to adjust the build command (e.g. if you use build flavors). Short explanation:

Thanks again!

IzzySoft avatar Jun 27 '26 12:06 IzzySoft