Skip to content

fix(android): enable R8 for release builds - #712

Merged
kipavy merged 1 commit into
devfrom
fix/android-r8
Oct 24, 2026
Merged

kipavy merged 1 commit into
devfrom
fix/android-r8

Conversation

@kipavy

@kipavy kipavy commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Play Console warns that the release DEX is below its optimization threshold (obfuscation 1 %). R8 was disabled on purpose because Rust calls app Kotlin classes by name over JNI.

Change

  • isMinifyEnabled = true for release, with proguard-android-optimize.txt, proguard-rules.pro and proguard-tauri.pro.
  • proguard-rules.pro keeps com.voltius.app.** whole (JNI from Rust: VoltiusKeychain, VoltiusBiometric, VoltiusTunnelService, VoltiusDownloads, SystemBars… and @JavascriptInterface bridges). Tauri's own classes are covered by the consumer rules its library ships.
  • -dontwarn for Tink's compile-only javax.annotation.Nullable / GuardedBy (pulled in by security-crypto), which otherwise fails the R8 task.
  • Libraries are now shrunk and renamed (e.g. androidx.activity.Api34Impl -> a.a); AGP bundles the mapping file into the AAB, so Play crash reports stay readable.

Tested on the emulator with an x86_64 release APK (R8 on, signed with the repo test keystore), installed over existing data:

  • cold start, splash, system bars, local vault unlocked through the Android keychain
  • generate an SSH key in Keychain, connect to a test sshd with it, type in the terminal with the soft keyboard
  • start a local tunnel: VoltiusTunnelService runs in the foreground and the port listens
  • SFTP download: folder picker (VoltiusDownloads.launchPicker), file written to Documents with the right content
  • share sheet from SFTP, app-lock biometric availability check
  • no ClassNotFoundException / NoSuchMethodError in logcat

🤖 Generated with Claude Code

https://claude.ai/code/session_015Ly4RP96nLUnj4FWtWthpE

Play Console flags the release DEX as almost unobfuscated (1 %). R8 was off
because Rust calls our Kotlin by name over JNI; proguard-rules.pro now keeps
com.voltius.app whole, Tauri's library ships rules for its own classes, and
Tink's compile-only javax.annotation references are silenced. Libraries
(AndroidX, Kotlin, Jackson...) are shrunk and obfuscated; AGP puts the mapping
file into the AAB for Play crash deobfuscation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015Ly4RP96nLUnj4FWtWthpE
@kipavy
kipavy merged commit ae77662 into dev Oct 24, 2026
5 checks passed
@kipavy
kipavy deleted the fix/android-r8 branch October 24, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant