Enable R8 for release builds

- Turn on minification for the release build and sign it with the debug key so it is
  installable for testing (a public release would use a dedicated keystore).
- proguard-rules.pro keeps the reflection-heavy mail/auth stack: Jakarta/Angus Mail
  (IMAP/SMTP providers resolved via reflection + service files) and AppAuth.
- Verified on the Android 17 emulator: the release APK builds with R8, installs, and
  syncs mail over IMAP — confirming Angus Mail's provider resolution survives shrinking.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-27 17:06:50 -05:00
co-authored by Claude Opus 4.8
parent 57b628f90f
commit 23afe78fe0
2 changed files with 22 additions and 14 deletions
+4 -1
View File
@@ -48,11 +48,14 @@ android {
buildTypes {
release {
isMinifyEnabled = false
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
)
// Sign release builds with the debug key so they're installable for testing.
// A public release would configure a dedicated upload/release keystore here.
signingConfig = signingConfigs.getByName("debug")
}
}
+18 -13
View File
@@ -1,14 +1,19 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# LibreMail ProGuard/R8 rules.
#
# Release builds are currently not minified (see app/build.gradle.kts). When
# minification is enabled for release, add keep rules for the email/auth stack:
#
# Jakarta / Angus Mail (reflection-based provider registration):
# -keep class jakarta.mail.** { *; }
# -keep class org.eclipse.angus.mail.** { *; }
# -keep class com.sun.mail.** { *; }
# -dontwarn jakarta.activation.**
#
# AppAuth:
# -keep class net.openid.appauth.** { *; }
# R8/ProGuard keep rules for LibreMail's release build.
# --- Jakarta / Angus Mail (IMAP/SMTP) ---
# Protocol providers (IMAP/SMTP stores and transports) are discovered via reflection and
# META-INF service files, so keep the mail and activation classes and their members intact.
-keep class jakarta.mail.** { *; }
-keep class jakarta.activation.** { *; }
-keep class org.eclipse.angus.mail.** { *; }
-keep class org.eclipse.angus.activation.** { *; }
-dontwarn jakarta.mail.**
-dontwarn jakarta.activation.**
-dontwarn org.eclipse.angus.**
-dontwarn com.sun.activation.**
# --- AppAuth ---
# AppAuth (de)serializes its models (AuthState, token responses) reflectively.
-keep class net.openid.appauth.** { *; }
-dontwarn net.openid.appauth.**