https://developer.android.com/agents/skills/r8-analyzer/skill

Analyze Android R8/ProGuard keep rules for redundancy and reflection impact.

5|Updated Feb 22, 2026
One-click install
npx skills add https://github.com/fornewid/android-developers-changelog --skill https-developer-android-com-agents-skills-r8-analyzer-skill
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: https://developer.android.com/agents/skills/r8-analyzer/skill
Source: https://github.com/fornewid/android-developers-changelog/tree/main/docs/agents/skills/r8-analyzer
Command: npx skills add https://github.com/fornewid/android-developers-changelog --skill https-developer-android-com-agents-skills-r8-analyzer-skill

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

R8/ProGuard keep rules often grow overly broad and prevent effective shrinking, leading to larger APKs and weaker optimization while still risking broken runtime behavior.

Core Features & Use Cases

  • Detects redundant and harmful keep rules: Flags library-wide keep patterns (e.g., AndroidX/Kotlin) that are typically unnecessary because dependencies ship their own consumer rules.
  • Refines keep rules using an impact hierarchy: Evaluates remaining rules and identifies broader rules that can be narrowed to reduce code retention.
  • Guides reflective retention precisely: Inspects code and adjacent usage patterns to suggest narrow keep rules aligned to reflection scenarios.

Quick Start

Run the r8-analyzer on your project to generate an R8 keep-rule analysis report and actionable removal/refinement recommendations.

Frequently Asked Questions about https://developer.android.com/agents/skills/r8-analyzer/skill

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find redundant ProGuard keep rules that are blocking R8 code shrinking?

Analyze your project's R8/ProGuard configuration to identify redundant keep rules blocking code shrinking. It flags library-wide patterns, such as AndroidX or Kotlin keeps, that are unnecessary because dependencies ship their own consumer rules.

What is the best way to refine overly broad keep rules in proguard-rules.pro?

The best way to refine overly broad keep rules is to evaluate them using an impact hierarchy, assessing subsumption to identify broader rules that can be narrowed to reduce code retention while maintaining runtime safety.

How do I keep classes safe from shrinking when using reflection in Android?

To keep classes safe from shrinking when using reflection, inspect code and adjacent usage patterns to suggest narrow keep rules specifically aligned to the reflection scenarios, preventing unnecessary code retention.

Can I analyze AGP and R8 settings across Gradle build scripts?

Yes, you can validate AGP and R8 settings across Gradle-based codebases by comparing build inputs against provided configuration references to review proguard-rules.pro and assess build optimization settings.

Does the R8 analyzer modify my proguard-rules.pro file directly?

No, the R8 analyzer does not modify rule files directly; it produces concise, actionable guidance and recommendations for removing or refining keep rules without altering your build configurations.