# R8 Analyzer

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

- Repository: https://github.com/android/skills (10219 stars)
- Category: Design
- License: Complete terms in LICENSE.txt
- Last updated: 2026-10-29
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add android/skills --skill r8-analyzer -g -a claude-code -y`
Codex: `npx skills add android/skills --skill r8-analyzer -g -a codex -y`
Cursor: `npx skills add android/skills --skill r8-analyzer -g -a cursor -y`
Gemini CLI: `npx skills add android/skills --skill r8-analyzer -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add android/skills`

## Description

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.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

## Step 1. Setup and configuration check

- Inspect `build.gradle`, `build.gradle.kts`, and `gradle.properties`.
- Use [references/CONFIGURATION.md](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](references/android/topic/performance/app-optimization/enable-app-optimization.md) 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)

The rest: https://github.com/android/skills/blob/HEAD/performance/r8-analyzer/SKILL.md
