From f7c29ebcd7b051b8daf78ee1613213af960307c1 Mon Sep 17 00:00:00 2001 From: BarbossHack Date: Sun, 26 Jul 2026 09:32:32 +0000 Subject: [PATCH] Update R8 configuration for deterministic and reproducible builds Resolves signalapp/Signal-Android#14899 --- gradle.properties | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index dc96f55579..d0ae140ab7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,12 @@ # R8 in AGP 9.x is non-deterministic, producing intermittent dex differences between # otherwise-identical builds. Two flags work together to stabilize it: -# - -Dcom.android.tools.r8.threadCount=1 removes thread-scheduling-dependent ordering. +# - -Dcom.android.tools.r8.deterministicdebugging=true run R8 compilation in a +# single thread and without randomly shuffling the input. # - -XX:hashCode=3 (deterministic incrementing Object.identityHashCode) removes # IdentityHashMap iteration-order non-determinism inside R8 (e.g. in # KotlinClassMetadataReader, which decides whether to keep the Signature attribute # on Kotlin generic lambda subclasses). -org.gradle.jvmargs=-Xmx12g -Xms256m -XX:MaxMetaspaceSize=1g -Dcom.android.tools.r8.threadCount=1 -XX:+UnlockExperimentalVMOptions -XX:hashCode=3 +org.gradle.jvmargs=-Xmx12g -Xms256m -XX:MaxMetaspaceSize=1g -Dcom.android.tools.r8.deterministicdebugging=true -XX:+UnlockExperimentalVMOptions -XX:hashCode=3 # Without this, the Kotlin compile daemon inherits -Xmx12g from org.gradle.jvmargs. kotlin.daemon.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=512m