t1k:unity:base:play-dex-r8-obfuscation-ratio
| Field | Value |
|---|---|
| Module | base |
| Version | 5.116.6 |
| Effort | low |
| Tools | — |
Keywords: padding classes, play r8 options, proguard-user.txt, repackage classes, resource shrinking
How to invoke
Section titled “How to invoke”/t1k:unity:base:play-dex-r8-obfuscation-ratio<aab> [old.aab] (editor stamp) | padding: gen_obf_pad.py; measurement is core t1k-android-aab-obfuscationUnity Android obfuscation remediation (Play “Obfuscation” threshold)
Section titled “Unity Android obfuscation remediation (Play “Obfuscation” threshold)”Unity-only: what to change in a Unity Android build when the Play obfuscation number fails. Launcher template, Play R8 options, padding classes and the SDK and Crashlytics gotchas live here.
Measurement is not here. The AAB measurement (proguard.map ratio, per-package compare, r8.json
cross-check, Maven library list, Waydroid smoke test) is engine-neutral and ships in the core skill
t1k-android-aab-obfuscation. Do not re-implement it in this skill.
No Editor, no mutex. Pure zip reads for the measurement. Never launch Unity to measure a bundle.
Where the core scripts are
Section titled “Where the core scripts are”S="$(ls -d .claude/skills/t1k-android-aab-obfuscation "$HOME/.claude/skills/t1k-android-aab-obfuscation" 2>/dev/null | head -1)/scripts"If test -d "$S" fails, the core skill is not installed: run t1k modules update (the dependency on
t1k-reverse-engineering pulls the host module), then retry. Invoke every core script as
python3 -I "$S/<script>". Exit codes are the core skill’s: 0 PASS, 1 FAIL, 2 usage, no map, or unreadable bundle.
Remediation: the owner decision
Section titled “Remediation: the owner decision”Call AskUserQuestion (multi-select) with these two options and nothing else. Do not offer any edit to
ad-network or SDK consumer rules: changing them does not raise the obfuscation ratio (owner decision 2026-11-13).
| Option | Status | What it does |
|---|---|---|
| Play R8 options (Resource Shrinking, Resource Shrinking Optimized, Repackage Classes) | DEFAULT: pre-selected, always applied | Enable steps: references/play-r8-options.md. Smoke-test before any tester upload (Gotchas). |
| Padding classes | OPTION, off by default | Lifts Play’s number and protects nothing. Sizing and costs: references/padding-classes.md. |
Apply the chosen options, then re-measure the new bundle with the core skill: python3 -I "$S/obfuscation_check.py" <new.aab>.
Padding is generated only after the user picks it (scripts/gen_obf_pad.py deletes and rewrites its --out directory).
Unity-owned scripts
Section titled “Unity-owned scripts”U=.claude/skills/t1k-unity-base-play-dex-r8-obfuscation-ratio/scriptspython -I "$U/unity_editor_version.py" app.aab [old.aab] # Unity editor version stamp (exit 0 / 2)python -I "$U/gen_obf_pad.py" --out <Unity>/Assets/Plugins/Android/ObfPad --package com.<app>.obfpad # padding (option, user-chosen)Hard rules
Section titled “Hard rules”- With the three items ON the app crashes at start unless the Crashlytics build id is kept.
com.crashlytics.android.build_idis removed frombase/resources.pb(present with the options OFF, absent with them ON): start fails with “The Crashlytics build ID is missing”. Ares/raw/keep.xmlwith only the dottedtools:keepname did NOT prevent it (MimicThatSound #121). A keep.xml listing the dotted AND underscore names (@string/com_crashlytics_android_build_id) plus wildcards (com.crashlytics.*,com_crashlytics_*) DID (MimicThatSound #122: id back inresources.pb, app starts on Waydroid). Which spelling is the effective one was not isolated (several changed in one build). The unity-version resource iscom.google.firebase.crashlytics.unity_version, notcom.crashlytics.android.unity_version. Do not upload a build with the options ON to testers without a start-up smoke test ("$S/waydroid_test.sh", core). Detail and the file:references/padding-classes.md§ Gotcha. - A Jenkins job without a branch parameter builds ONLY its configured branch spec. MimicThatSound’s Release job built
*/chore/applovin-sdk-8-6-6(version 8-6-6, no padding, 18.61%) whenrelease-1.0.2was wanted; a push to the branch it watches also auto-triggers a build, and kit-sync commits (.claude/only) trigger one each. Before trusting a number, read the log’sSelected branch:andVersion: ... Commit:lines. - Measuring through Jenkins: a Release-job build can be a stale commit (a push event queued it): supersede it with a forced
trigger and check the SHA. Packages can resolve to old versions: wipe the workspace (
PARAM_WIPE_OUT_WORKSPACE=true, which ends in failure by design) before trusting the numbers. Root cause not proven:references/known-causes.md§ Measuring through Jenkins. - Global R8 options do not belong in
proguard-user.txt. Unity exports it as the unityLibraryconsumerProguardFile;-repackageclasses,-allowaccessmodification,-dontobfuscate,-dontoptimize,-dontshrink,-overloadaggressively… fail the build in:unityLibrary:exportReleaseConsumerProguardFiles(Gradle error “Global keep option … should not be used in a consumer rules file”). They need a non-consumer rules file (customlauncherTemplate.gradle).isAccessModificationEnabledis already true in Unity 6 / R8 9.x, checkr8.jsonoptionsfirst (corer8subcommand). - Narrowing project keep rules moves the metric little. Measured on SprunkiSoundCollection: removing
broad
-keepfor ironsource/gms/play-core/facebook/kotlin.collections took Play obf/opt/shrink from 19.47/19.31/25.09 to 21.01/20.85/27.25. What stays kept is SDK-shipped consumer rules (yads, inmobi, ironsource, appmetrica, chartboost), which a project rule cannot undo: only dropping the adapter moves it. - AppLovin Quality Service (SafeDK) pins half the DEX.
AppLovinSettings.assetqualityServiceEnabled: 1makes thecom.applovin.qualityGradle plugin writeGradle/.safedk/proguard-safedk.pro: 77 broad-keeprules (androidx.**, okhttp3, com.applovin.**, ironsource, vungle, unity3d.ads, gms.ads…). Measured: turning it off cut the DEX 68.4k to 57.9k classes and moved Play obf/opt/shrink 21.01/20.85/27.25 to 22.64/22.53/29.87. It also turns off AppLovin Ad Review, so it is a product call, not a free fix. - Reading the merged R8 rules (which SDK keeps what). Not
-printconfigurationinproguard-user.txt(AGP rejects it there), not a path under the workspace (not archived), not stdout (not in the log). Use a customlauncherTemplate.gradle(useCustomLauncherGradleManifest: 1) with atasks.configureEachhook that printslauncher/build/outputs/mapping/release/configuration.txtafterminifyReleaseWithR8and then throws: Unity prints Gradle output only when Gradle fails. Each rule carries its origin file.
Deeper cause catalogue and worked numbers: references/known-causes.md.
Executed by
Section titled “Executed by”The core scripts are deterministic reads of a finished bundle: t1k-fact-fetcher (haiku) runs them and quotes their
output verbatim. The diagnosis (which packages stayed kept, what a drop means) and any change to keep rules stay with the
reasoning-tier caller (t1k-unity-base-developer). scripts/gen_obf_pad.py is not a measurement: it deletes and rewrites
its --out directory, so it stays with the caller too, and only after the user has chosen padding.
Unity remediation for a failing Play obfuscation threshold: launcher template, Play R8 options, padding, SDK rules, and the
Unity build gotchas above. Not: measurement or diagnosis of an AAB (core t1k-android-aab-obfuscation), the Unity build gate
(t1k-unity-base-build-gate), Editor compile/run verbs (t1k-unity-editor-cli), or the Play upload itself (CI/Jenkins).
Related
Section titled “Related”t1k-android-aab-obfuscation(core,t1k-reverse-engineeringmodule) — the measurement and the diagnosis tablet1k-unity-base-build-gate— failing a build in the Editor/CI instead of measuring a finished bundlet1k-jenkins-build,t1k-jenkins-unity— where the AAB is producedreferences/known-causes.md— the 2026-10 editor-version drop on this project; Jenkins measuring gotchasreferences/padding-classes.md— padding classes and Play’s three R8 items, 2026-11 measurements (MimicThatSound, TheOneFeatureProject)references/play-r8-options.md— enabling the three Play R8 items on Unity 6000.3.25f1 / AGP 9.0.0 (verified 2026-11-13)references/consumer-rule-override.md— reference only; not suggested for raising the ratio (owner decision 2026-11-13)