Skip to content

chore(r8): drop R8 options that no longer do anything - #1371

Merged
bmc08gt merged 1 commit into
code/cashfrom
chore/prune-dead-r8-options
Aug 30, 2026
Merged

chore(r8): drop R8 options that no longer do anything#1371
bmc08gt merged 1 commit into
code/cashfrom
chore/prune-dead-r8-options

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

Four options at the top of proguard-rules.pro and three rules at the bottom were either inert or already supplied by the libraries that need them.

The two inert options

-optimizationpasses is a ProGuard option; R8 parses and ignores it. -dontusemixedcaseclassnames only matters when writing class files to a case-insensitive filesystem, which R8 does not do when it emits DEX.

The obfuscation dictionaries

Both point at shuffled-dictionary.txt, whose 811 entries are all exactly four characters. Without it R8 assigns names by frequency: 736k of 1.2M member mappings get one-character names. Feeding R8 a fixed four-character alphabet is strictly worse, but only slightly — DEX interns strings, so a longer name costs pool bytes once rather than per reference.

Measured on two release builds of this branch's parent:

with dictionary without
DEX (uncompressed) 16,103,860 16,101,032
renamed classes given 4-char names 911 10

2,828 bytes. Removing the dictionary is about dropping an 811-line file nothing else reads, not about size.

The Retrofit signature rules

retrofit2.Call, retrofit2.Response and kotlin.coroutines.Continuation are kept by Retrofit's own META-INF/proguard/retrofit2.pro, which also carries the -keepattributes Signature, InnerClasses, EnclosingMethod they depend on. Retrofit 3.0.0 keeps Response and Continuation with identical rule text; Call is covered by its conditional return-type rule (-if interface * { @retrofit2.http.* public *** *(...); } -keep,allowoptimization,allowshrinking,allowobfuscation class <3>) rather than a literal keep.

Room

-keep class * extends androidx.room.RoomDatabase in services/flipcash/consumer-rules.pro is subsumed by the equivalent rule Room already ships.


Release R8 output is unchanged across the two builds: both keep 21,361 classes and 1,330,404 members. Only the assigned names differ.

Four options at the top of proguard-rules.pro and three rules at the bottom
were either inert or already supplied by the libraries that need them.

-optimizationpasses is a ProGuard option; R8 parses and ignores it.
-dontusemixedcaseclassnames only matters when writing class files to a
case-insensitive filesystem, which R8 does not do when it emits DEX.

The two obfuscation dictionaries point at shuffled-dictionary.txt, whose 811
entries are all exactly four characters. Without it R8 assigns names by
frequency, so 736k of 1.2M member mappings get one-character names. Feeding it
a fixed four-character alphabet is strictly worse, but only slightly: DEX
interns strings, so the dictionary only displaced 911 of 18,601 renamed
classes and cost 2,828 bytes of DEX (16,103,860 -> 16,101,032). Removing the
dictionary is about dropping an 811-line file nothing else reads, not size.

The retrofit2.Call/Response and kotlin.coroutines.Continuation signature rules
ship in Retrofit's own META-INF/proguard/retrofit2.pro, along with the
-keepattributes Signature they depend on. Retrofit 3.0.0 keeps Response and
Continuation with identical rule text, and covers Call through its conditional
return-type rule rather than a literal keep.

-keep class * extends androidx.room.RoomDatabase in services/flipcash is
subsumed by the equivalent rule Room already ships.

Release R8 output is unchanged: both builds keep 21,361 classes and 1,330,404
members. Only the assigned names differ.
@bmc08gt bmc08gt self-assigned this Aug 30, 2026
@github-actions github-actions Bot added type: chore Maintenance, config, CI/CD area: network gRPC, connectivity, API, exchange rates and removed type: chore Maintenance, config, CI/CD labels Aug 30, 2026
@bmc08gt
bmc08gt merged commit 6d923f0 into code/cash Aug 30, 2026
3 checks passed
@bmc08gt
bmc08gt deleted the chore/prune-dead-r8-options branch August 30, 2026 19:27
bmc08gt added a commit that referenced this pull request Aug 31, 2026
…obuf-keep-rules

* origin/code/cash:
  perf(r8): keep exception names without keeping every exception (#1373)
  fix(bugsnag): give the app and the uploaded mapping the same build UUID (#1374)
  chore(r8): drop R8 options that no longer do anything (#1371)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: network gRPC, connectivity, API, exchange rates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant