From d492606f01a24c242beef2249c5e3ca5b6f83650 Mon Sep 17 00:00:00 2001 From: sh <37271604+shumvgolove@users.noreply.github.com> Date: Fri, 3 Jul 2026 20:15:53 +0400 Subject: [PATCH] scripts: match AGP zip alignment in android reproduce build (#7196) Release APKs are packaged by AGP (:android:assembleRelease), which zero-pads ZIP alignment. verify_apk re-aligned the rebuilt APK with repro-apk's --pad-like-apksigner (the 0xd935 extra-field scheme of standalone apksigner >= 35.0.0-rc1), so apksigcopier aborted with "APK Signing Block offset < central directory offset". Drop the flag so the padding matches AGP's output; the rebuilt APK then reproduces the published one byte-for-byte. --- scripts/simplex-chat-reproduce-builds-android.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/simplex-chat-reproduce-builds-android.sh b/scripts/simplex-chat-reproduce-builds-android.sh index 20c2fdf116..f8bb3224cc 100755 --- a/scripts/simplex-chat-reproduce-builds-android.sh +++ b/scripts/simplex-chat-reproduce-builds-android.sh @@ -118,9 +118,14 @@ check_apk() { verify_apk() { apk_name="$1" + # Release APKs are packaged by AGP (gradle :android:assembleRelease; AGP version is + # gradle.plugin.version in apps/multiplatform/gradle.properties), which zero-pads ZIP + # alignment. Do NOT add --pad-like-apksigner (standalone apksigner >= 35.0.0-rc1 uses + # the 0xd935 extra-field padding) unless AGP is bumped to a packager that uses it — + # otherwise apksigcopier aborts with "APK Signing Block offset < central directory offset". # https://github.com/obfusk/apksigcopier?tab=readme-ov-file#what-about-signatures-made-by-apksigner-from-build-tools--3500-rc1 - docker exec "${CONTAINER_NAME}" repro-apk zipalign --page-size 16 --pad-like-apksigner --replace "${DOCKER_PATH_VERIFY}/${apk_name}.${SUFFIX_BUILT}" \ - "${DOCKER_PATH_VERIFY}/${apk_name}.aligned" + docker exec "${CONTAINER_NAME}" repro-apk zipalign --page-size 16 --replace "${DOCKER_PATH_VERIFY}/${apk_name}.${SUFFIX_BUILT}" \ + "${DOCKER_PATH_VERIFY}/${apk_name}.aligned" docker exec "${CONTAINER_NAME}" mv "${DOCKER_PATH_VERIFY}/${apk_name}.aligned" \ "${DOCKER_PATH_VERIFY}/${apk_name}.${SUFFIX_BUILT}"