r8-analyzer

Analyze Android R8 keep rules for redundant and subsuming rules.

8|1|Updated Mar 30, 2026
One-click install
npx skills add https://github.com/drewid74/ai_skills --skill r8-analyzer-drewid74
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: r8-analyzer
Source: https://github.com/drewid74/ai_skills/tree/main/android-r8-analyzer
Command: npx skills add https://github.com/drewid74/ai_skills --skill r8-analyzer-drewid74

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Redundant or overly broad R8/ProGuard keep rules bloat your APK/AAB and make shrinking harder to reason about, causing slow builds and unnecessary size overhead.

Core Features & Use Cases

  • Keep-rule redundancy detection: Identifies library-wide keep rules that are unnecessary when they target common libraries (Google/AndroidX/Kotlin/Room/Gson/Retrofit and more).
  • Subsumption and hierarchy-based refinement: Detects broader rules that subsume narrower consumer rules using an impact hierarchy.
  • Reflection-aware narrowing guidance: Connects remaining rules to likely reflection use and recommends more specific keep rules for the codebase.
  • Actionable cleanup plan: Produces concise per-rule remove/refine instructions, ordered by impact on the codebase hierarchy.

Quick Start

Use the r8-analyzer skill to analyze your Android build and ProGuard/R8 keep rules and generate R8_Configuration_Analysis.md with precise removal/refinement recommendations.

Frequently Asked Questions about r8-analyzer

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

FAQPage Schema
How do I find redundant ProGuard keep rules to reduce my Android app size?

Redundant R8 keep rules can be found by scanning your Gradle Android project configuration for library-wide rules that overlap with narrower consumer ProGuard rules. The analysis outputs an ordered list of rules to remove or refine for smaller app packages.

What is an R8 keep rule impact hierarchy and how does it optimize shrinking?

An R8 keep rule impact hierarchy maps how broader keep rules subsume narrower consumer rules. By analyzing this hierarchy, you can pinpoint and remove redundant ProGuard rules that bloat your app while preserving the necessary shrinking behavior.

How do I narrow down broad R8 keep rules that target common Android libraries?

To narrow broad R8 keep rules targeting common Android libraries, apply reflection-aware guidance that connects remaining rules to actual reflection use. This generates more specific keep rules tailored to your codebase, optimizing the Gradle build configuration.

Can I analyze build.gradle.kts and proguard files to troubleshoot R8 configurations?

Yes, you can analyze Gradle-based Android projects by scanning build.gradle, build.gradle.kts, gradle.properties, and proguard configuration files. This identifies redundant keep rules and generates actionable removal or refinement recommendations for your build.

What's the best way to generate an actionable cleanup plan for R8 keep rules?

The best way to generate a cleanup plan is to analyze R8 keep rules using an impact hierarchy and reflection guidance. This produces an ordered set of precise per-rule remove or refine instructions, maximizing APK and AAB size optimization.

Why does my Android app still have unnecessary size overhead after enabling R8 shrinking?

Unnecessary size overhead often persists because of overly broad or redundant R8 keep rules that prevent the shrinker from removing unused code. Analyzing your ProGuard configuration for subsumption and library-wide rules can pinpoint and resolve this bloat.