Skills

R8 Analyzer

Analyzes Android build files and R8 keep rules to identify redundancies, broad...

Install

npx skills add android/skills --skill r8-analyzer -g -a claude-code -y
Repository
android/skills10.2k
Category
Design
Updated
6d ago
License
Complete terms in LICENSE.txt
Context cost
Lightabout 1,409 tokens
Runs scripts
Yes, review before use

What it does

Analyzes Android build files and R8 keep rules to identify redundancies, broad package-wide rules, and rules that subsume library consumer keep rules. Use this skill when developers want to optimize their Android app's size, remove redundant or overly broad keep rules, or troubleshoot ProGuard configurations. Don't use for general Gradle build errors, Compose UI performance, or runtime CPU profiling.

Step 1. Setup and configuration check

  • Inspect build.gradle, build.gradle.kts, and gradle.properties.
  • Use references/CONFIGURATION.md to identify missing optimizations.
  • AGP : If the version is lower than 9.3, suggest migration to 9.3 for the simplified optimization {} DSL and the Configuration Analyzer task.
  • Full mode : Verify android.enableR8.fullMode=false is removed from the gradle.properties file.

Step 2. Analysis path selection

  • Inspect build.gradle, build.gradle.kts, settings.gradle, settings.gradle.kts, gradle.properties, and libs.versions.toml to get the AGP and R8 versions. An R8 version pinned in settings.gradle(.kts) replaces the R8 bundled with AGP.

  • Find the app module (usually app) and a build variant with R8 enabled (usually release). The following commands use them as <module> and <Variant>, for example :app:minifyReleaseWithR8.

  • The helper scripts are in this skill's scripts/ directory. In the following commands, <skill_dir> is this skill's directory. Run every command from the project root.

  • If AGP >= 9.3.0 : Proceed to Path A (Standalone Task).

  • If AGP < 9.3.0 : Proceed to Path B (Quantitative).

Path A: Standalone Gradle task (AGP >= 9.3.0)

Read the whole SKILL.md on GitHub

More in Design