I compared two builds on two different machines with what is very likely our toolchain to come (armv7) and it turns out the .apk files are nor built reproducibly anymore.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items 0
Show closed items
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items 0
Link issues together to show that they're related.
Learn more.
Okay, here are my findings so far: the sole differences (apart from the signature and different sha1 sums in the MANIFEST files) are in resources.arsc. The good news here is that disassembling the whole .apk with something like apktools shows not differences anymore apart from the signature and sha1 ones mentioned above which are due to resources.arsc being different. Thus, the problem lies in how that file gets assembled.
Dump the contents with aapt dump resources and diffing the results gets us differences like:
I added sorting the input files in AGP in change list with Change-Id: I371304c8a6d244f8bb7833609f464eba000e608f - it should be available in android gradle plugin version 3.5 Canary 7
We cherry picked it into 3.4 and it should be available in the next 3.4 canary. We'll see what we can do about 3.3.
Hm. Did they say when it got introduced? Is our reproducible builds setup broken that we did not detect that problem during the esr60 cycle? Or is that really a thing that got introduced with the new toolchain we use.
That said, sisbell, what are our options here? Can we just use a newer gradle plugin which has this fixed? Or do we need to build that one ourselves and use it then or...?
Hm. Did they say when it got introduced? Is our reproducible builds setup broken that we did not detect that problem during the esr60 cycle? Or is that really a thing that got introduced with the new toolchain we use.
That said, sisbell, what are our options here? Can we just use a newer gradle plugin which has this fixed? Or do we need to build that one ourselves and use it then or...?
In the google issuetracker. one person mentioned that they got around the issue by using aapt2 directly with the correct order in the linker. I think this is worth investigating since it could potentially be scripted without requiring a patch. My only concern is that Firefox has a customized build so it may not be extendible to this approach. It requires looking into.
I've tried doing the linking for resources and then merging the apks but haven't had much luck when starting the app. I get various crashes. I'll investigate more.
08-31 02:02:43.923 31309 31309 W PackageManager: Failure retrieving xml 0x7f130014 in package org.torproject.torbrowser08-31 02:02:43.923 31309 31309 W PackageManager: android.content.res.Resources$NotFoundException: Resource ID #0x7f13001408-31 02:02:43.923 31309 31309 W PackageManager: at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:237)
Is our reproducible builds setup broken that we did not detect that problem during the esr60 cycle? Or is that really a thing that got introduced with the new toolchain we use.
https://hg.mozilla.org/mozilla-central/rev/787dce710dce
Is our reproducible builds setup broken that we did not detect that problem during the esr60 cycle? Or is that really a thing that got introduced with the new toolchain we use.
https://hg.mozilla.org/mozilla-central/rev/787dce710dce
Thanks, I'll try android.enableAapt2=false and see if we get a different result for the resource file.
The enableAapt2=false option results in a proguard error. So the current firefox build doesn't work out of the box with aapt2 disabled.
0:45.03 Warning: there were 13 unresolved references to classes or interfaces. 0:45.03 You may need to add missing library jars or update their versions. 0:45.03 If your code works fine without the missing classes, you can suppress 0:45.03 the warnings with '-dontwarn' options. 0:45.03 (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass) 0:45.04 Warning: Exception while processing task java.io.IOException: Please correct the above warnings first. 0:45.04 Thread(Tasks limiter_1): destruction 0:45.04 > Task :app:transformClassesAndResourcesWithProguardForWithoutGeckoBinariesDebug FAILED 0:45.04 FAILURE: Build failed with an exception. 0:45.04 * What went wrong: 0:45.04 Execution failed for task ':app:transformClassesAndResourcesWithProguardForWithoutGeckoBinariesDebug'.
The enableAapt2=false option results in a proguard error. So the current firefox build doesn't work out of the box with aapt2 disabled.
I am not convinced yet we should go that route. It seems the move to aapt2 might have helped in "fixing" unexplainable crashes. We should not risk getting those back if possible. We should maybe have hit those by now (and maybe users have but did not report) but, still, I am wary of switching back to the older tool.
Could we downgrade the gradle plugin "easily" to an earlier version that was still good?
So the 3.0.1 fails due to needing to accept license agreements for SDK. Notice that it is requiring build tools 26.0.2. So the downgrading the plugin also requires downgrading the toolchain as well.
0:37.28 21:25:31.055 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Configure build' completed 0:37.37 21:25:31.062 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 0:37.37 21:25:31.062 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception. 0:37.37 21:25:31.062 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 0:37.37 21:25:31.062 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong: 0:37.37 21:25:31.062 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] A problem occurred configuring project ':app'. 0:37.37 21:25:31.062 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > You have not accepted the license agreements of the following SDK components: 0:37.37 21:25:31.062 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] [Android SDK Build-Tools 26.0.2]. 0:37.37 21:25:31.062 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager. 0:37.37 21:25:31.062 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html 0:37.37 21:25:31.062 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
The latest version that worked was using com.android.tools.build:gradle:3.0.1, buildToolsVersion '26.0.2' and aaptOptions { cruncherEnabled = false }
So, did you test with just adding aaptOptions { cruncherEnabled = false }? Any change in diff?
https://bugzilla.mozilla.org/show_bug.cgi?id=1266156
Sounds to me like wallpapering over the underlying problem by taking extra steps during the verification process to work around the still existing differences, no? If so, I am not a big fan of those approaches.
A third route is to build and patch the gradle plugin ourselves but I have been unable to find the elusive change-id that google mentions.
This one could maybe work as a temporary workaround. However this requires fuse to be installed on the build machine, and I'm not sure if different distributions have different fuse versions/setup that could make things more complicate.
A third route is to build and patch the gradle plugin ourselves but I have been unable to find the elusive change-id that google mentions.
This sounds like the best way to fix it. However I have not even been able to find their source code repository so far. Do you know if they have one?