Android APK Size Optimization: Removing Duplicate Resources and Image Compression with a Gradle Plugin
This article explains how the Android resources.arsc file is generated, identifies the problem of duplicate and uncompressed image resources in multi‑module projects, and presents a Gradle‑based solution that inserts a custom task after processReleaseResources to deduplicate resources, compress images using pngquant, guetzli and cwebp, and repack the .ap_ files, resulting in significant APK size reduction.