keep.xml
37 lines · 2.3 KB
Changed in: 0.5.0
| 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <!-- |
| 3 | Resource shrinker keep-list. |
| 4 | |
| 5 | Manifest-only references that the shrinker can't see: |
| 6 | - Fonts (fraunces, inter): loaded dynamically via Resources.getIdentifier |
| 7 | rather than as compile-time R.font.* references. Without this keep, |
| 8 | release builds with isShrinkResources = true strip the fonts and every |
| 9 | string in the app falls back to system Serif / SansSerif. |
| 10 | - TV launcher banner (tv_banner): referenced only from AndroidManifest.xml's |
| 11 | android:banner attribute, which the shrinker analyzes separately from |
| 12 | resource references in code. Symptom when stripped: Android TV launchers |
| 13 | render the wrong drawable in the banner slot — typically ic_launcher |
| 14 | (the round phone-launcher badge) cropped to 16:9, because shrinker rewrites |
| 15 | the manifest banner reference to a surviving resource ID. |
| 16 | - Launcher icons (ic_launcher, ic_launcher_round): also only referenced from |
| 17 | manifest attributes (android:icon, android:roundIcon, android:logo). Kept |
| 18 | defensively for the same reason. |
| 19 | - Notification icon (ic_notification): referenced from PlaybackService via |
| 20 | R.drawable.ic_notification, so the shrinker DOES see it — but kept here |
| 21 | alongside the others to make the brand-asset surface explicit. |
| 22 | - Bronze clef large-icon fallback (empty_clef): referenced from |
| 23 | BrowseScreen Kotlin code. Kotlin references are visible to the shrinker, |
| 24 | but kept here for the same explicit-surface reason. |
| 25 | - Earhorn badge (earhorn_badge): the canonical brand mark, referenced by |
| 26 | several painterResource calls in Compose UI AND by LocalRenderer's |
| 27 | defaultArtworkUri which builds an android.resource:// URI from the |
| 28 | resource ID at runtime. The string-formatted URI is opaque to the |
| 29 | shrinker; without this keep, release builds could strip the resource |
| 30 | even though painterResource sites still reference it (defense in depth). |
| 31 | |
| 32 | tools:keep forces the shrinker to retain these entries even though no code |
| 33 | references them statically (or, in some cases, even when code DOES reference |
| 34 | them — defense in depth for brand assets). |
| 35 | --> |
| 36 | <resources xmlns:tools="http://schemas.android.com/tools" |
| 37 | tools:keep="@font/fraunces,@font/inter,@drawable/tv_banner,@mipmap/ic_launcher,@mipmap/ic_launcher_round,@drawable/ic_notification,@drawable/empty_clef,@drawable/earhorn_badge" /> |


