From 29bab0b1be1e9f4cab23c29ac24b1ea46c6ba566 Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Tue, 22 Sep 2026 09:17:55 -0400 Subject: [PATCH] Update build args for reproducible builds. --- gradle.properties | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9b62abf05d..254845da9b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,12 +1,9 @@ -# 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.deterministicdebugging=true runs 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). +# To prevent non-deterministic R8 issues, we set some flags. +# The determinstic debugging one is self-explanatory, but also not as far-reaching as you'd hope. +# The hashcode one uses a more determinstic hashcode (an incrementing counter). +# Paired with the threadPoolSize=1 below, this should give us what we need. org.gradle.jvmargs=-Xmx12g -Xms256m -XX:MaxMetaspaceSize=1g -Dcom.android.tools.r8.deterministicdebugging=true -XX:+UnlockExperimentalVMOptions -XX:hashCode=3 +android.r8.threadPoolSize=1 # Without this, the Kotlin compile daemon inherits -Xmx12g from org.gradle.jvmargs. kotlin.daemon.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=512m