Irreproducible builds when using AppCompat library

Hi, I am trying to add my app into F-Droid repository with reproducible builds enabled, but currently blocked by irreproducible local build of AndroidX AppCompat resources.

No matter I use fdroid build or gradle build in IDE, the issue is same. Two drawable resources abc_ic_menu_cut_mtrl_alpha.png and abc_ic_menu_copy_mtrl_am_alpha.png from androidx.appcompat:appcompat:1.1.0 library appear in different folders of artifact apk when builds several times against same code base.

Here I ran fdroid build twice on same app version, the results are different, both failed, but the second one reported diff of two drawables. Also there is once I succeed with the same code base.

============================================================
versionCode: 56
versionName: 2.6.16
commit: ad6da3814a450815af059d3303bed28b0f3a0c58
Build completed at 2019-10-10 09:42:41Z

== Installed Android Tools ==

* build-tools/28.0.3 (28.0.3)
* build-tools/29.0.0 (29.0.0)
* cmake/3.6.4111459 (3.6.4111459)
* emulator (29.0.11)
* extras/android/m2repository (47.0.0)
* extras/google/m2repository (58)
* extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.2 (1)
* extras/m2repository/com/android/support/constraint/constraint-layout/1.0.2 (1)
* patcher/v4 (1)
* platform-tools (29.0.1)
* platforms/android-27 (3)
* platforms/android-28 (6)
* platforms/android-29 (3)
* platforms/android-Q (1)
* tools (25.2.5)

compared built binary to supplied reference binary but failed
==== detail begin ====
Unexpected diff output:
Only in /var/folders/c7/66kjtx_x37j8qbk9crhy7yy00000gp/T/tmpjdb4ip6l/unsigned_binaries_xyz.jienan.xkcd_56.binary/content/res/drawable-ldrtl-xxxhdpi-v17: abc_ic_menu_cut_mtrl_alpha.png
Only in /var/folders/c7/66kjtx_x37j8qbk9crhy7yy00000gp/T/tmpjdb4ip6l/_var_folders_c7_66kjtx_x37j8qbk9crhy7yy00000gp_T_tmpjdb4ip6l_sigcp_xyz.jienan.xkcd_56/content/res/drawable-xxxhdpi-v4: abc_ic_menu_cut_mtrl_alpha.png
Binary files /var/folders/c7/66kjtx_x37j8qbk9crhy7yy00000gp/T/tmpjdb4ip6l/unsigned_binaries_xyz.jienan.xkcd_56.binary/content/resources.arsc and /var/folders/c7/66kjtx_x37j8qbk9crhy7yy00000gp/T/tmpjdb4ip6l/_var_folders_c7_66kjtx_x37j8qbk9crhy7yy00000gp_T_tmpjdb4ip6l_sigcp_xyz.jienan.xkcd_56/content/resources.arsc differ
==== detail end ====



============================================================
versionCode: 56
versionName: 2.6.16
commit: ad6da3814a450815af059d3303bed28b0f3a0c58
Build completed at 2019-10-10 09:45:41Z

== Installed Android Tools ==

* build-tools/28.0.3 (28.0.3)
* build-tools/29.0.0 (29.0.0)
* cmake/3.6.4111459 (3.6.4111459)
* emulator (29.0.11)
* extras/android/m2repository (47.0.0)
* extras/google/m2repository (58)
* extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.2 (1)
* extras/m2repository/com/android/support/constraint/constraint-layout/1.0.2 (1)
* patcher/v4 (1)
* platform-tools (29.0.1)
* platforms/android-27 (3)
* platforms/android-28 (6)
* platforms/android-29 (3)
* platforms/android-Q (1)
* tools (25.2.5)

compared built binary to supplied reference binary but failed
==== detail begin ====
Unexpected diff output:
Only in /var/folders/c7/66kjtx_x37j8qbk9crhy7yy00000gp/T/tmpxlg7rx7i/unsigned_binaries_xyz.jienan.xkcd_56.binary/content/res/drawable-ldrtl-xxxhdpi-v17: abc_ic_menu_copy_mtrl_am_alpha.png
Only in /var/folders/c7/66kjtx_x37j8qbk9crhy7yy00000gp/T/tmpxlg7rx7i/unsigned_binaries_xyz.jienan.xkcd_56.binary/content/res/drawable-ldrtl-xxxhdpi-v17: abc_ic_menu_cut_mtrl_alpha.png
Only in /var/folders/c7/66kjtx_x37j8qbk9crhy7yy00000gp/T/tmpxlg7rx7i/_var_folders_c7_66kjtx_x37j8qbk9crhy7yy00000gp_T_tmpxlg7rx7i_sigcp_xyz.jienan.xkcd_56/content/res/drawable-xxxhdpi-v4: abc_ic_menu_copy_mtrl_am_alpha.png
Only in /var/folders/c7/66kjtx_x37j8qbk9crhy7yy00000gp/T/tmpxlg7rx7i/_var_folders_c7_66kjtx_x37j8qbk9crhy7yy00000gp_T_tmpxlg7rx7i_sigcp_xyz.jienan.xkcd_56/content/res/drawable-xxxhdpi-v4: abc_ic_menu_cut_mtrl_alpha.png
Binary files /var/folders/c7/66kjtx_x37j8qbk9crhy7yy00000gp/T/tmpxlg7rx7i/unsigned_binaries_xyz.jienan.xkcd_56.binary/content/resources.arsc and /var/folders/c7/66kjtx_x37j8qbk9crhy7yy00000gp/T/tmpxlg7rx7i/_var_folders_c7_66kjtx_x37j8qbk9crhy7yy00000gp_T_tmpxlg7rx7i_sigcp_xyz.jienan.xkcd_56/content/resources.arsc differ
==== detail end ====

This is my repository, GitHub - zjn0505/xkcd-Android: xkcd app for xkcd comics. I’ve tried a bunch of variations, including

  • cruncherEnabled, true and false
  • shrinkResources, true and false
  • supportsRtl, true and false
  • add keep.xml to keep or discard these resources

But none of above worked, there two resources kept appear randomly in different folders.

I’ve asked the same question on StackOverflow. I repost it here, since this is where the most people care about reproducible builds.

1 Like

It turns out to be the booster framework I used “optimized” the resources and broke the reproducibility.

When I tested in an empty Hello world project without this framework, everything is reproducible.

4 Likes

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