oxyroid / M3UAndroid

FOSS Player, which made of jetpack compose. Android 8.0 and above supported.
https://t.me/m3u_android
Apache License 2.0
450 stars 43 forks source link

Reproducible Builds #180

Open IzzySoft opened 3 months ago

IzzySoft commented 3 months ago

I've checked your app if its build is reproducible (see: Reproducible bulds, special client support and more in our repo), but while I was able to successfully generate the APK using ./gradlew assembleRelease, there was a load of differences between the two APKs. Start of the APK diff:

-------------------------------
--- /dev/fd/63  2024-07-10 12:47:51.688719016 +0200
+++ /dev/fd/62  2024-07-10 12:47:51.688719016 +0200
@@ -327,7 +327,7 @@
   res/0c.9.png
   32-bit CRC value (hex):                         95bbccff
   res/0c.png
-  32-bit CRC value (hex):                         f5d1119a
+  32-bit CRC value (hex):                         4dbb75d0
   res/0n.png
   32-bit CRC value (hex):                         c81c99e6
   res/0x.9.png
@@ -393,7 +393,7 @@
   res/2x.xml
   32-bit CRC value (hex):                         4d5f6c8c
   res/3-.png
-  32-bit CRC value (hex):                         a81955ac
+  32-bit CRC value (hex):                         44766c30
   res/33.9.png
   32-bit CRC value (hex):                         c5fedfaf
   res/35.png
@@ -415,7 +415,7 @@
   res/3u.9.png
   32-bit CRC value (hex):                         cff461f2
   res/3z.png
-  32-bit CRC value (hex):                         bd731efa
+  32-bit CRC value (hex):                         bab49c82
   res/3z1.png
   32-bit CRC value (hex):                         55f5805d
   res/42.9.png
@@ -447,7 +447,7 @@
…

Seems like all the differences were caused by assets (here: PNG), while not all of the PNGs had differences. Which might indicate your build process uses some "crunching" mechanism; those are non-deterministic and hence lead to different results on each run.

We'd appreciate if you could help making your build reproducible. We've prepared some hints on reproducible builds for that. If my guess here is right, you should especially look at the section on "Compressing images" – and the following addition to your build.gradle could cure this:

android {
    aaptOptions {
        cruncherEnabled = false
    }
}

Though I see you already have isCrunchPngs = false set; I'm no Android dev so I cannot tell how the two are related (or if the all section is also applied to the 2 sections above).

Looking forward to your reply!

IzzySoft commented 3 months ago

@oxyroid you're still around? Any word on the above?

oxyroid commented 3 months ago

I have less time to pay my attention in the repos recently. 🥲

IzzySoft commented 3 months ago

Eh, that happens. And I didn't exactly expect everyone to jump when I open an issue. I was just hoping for some reaction – so thanks for giving it! Now I know you're aware of the problem, but currently have no time to dig in (totally fair). Can you give me any ETA? Is it fine to give you a heads-up here from time to time (maybe once a month or so)?

oxyroid commented 3 months ago

sry I can't.

oxyroid commented 3 months ago

I'm stuck in a busy job in a busy department at a busy company.

IzzySoft commented 3 months ago

OK, no worries. Hope its OK for you if I send a friendly heads-up from time to time (not more often than once a month)?

IzzySoft commented 2 weeks ago

I assume the busy-bees are still keeping you busy?