r8-analyzer

Analyzes Android R8 keep rules to identify redundant and overly broad ProGuard configurations.

Updated Mar 12, 2026
One-click install
npx skills add https://github.com/RavitejaKarra24/dotfiles --skill r8-analyzer-ravitejakarra24
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: r8-analyzer
Source: https://github.com/RavitejaKarra24/dotfiles/tree/main/pi/.pi/agent/skills/r8-analyzer
Command: npx skills add https://github.com/RavitejaKarra24/dotfiles --skill r8-analyzer-ravitejakarra24

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires protobuf, and includes references (resource) components.

What problem does it solve? Android apps often accumulate redundant or overly broad R8/ProGuard keep rules that block code shrinking, obfuscation, and optimization, inflating app size. This Skill audits your build configuration and keep rules to pinpoint exactly which rules to remove or refine. ## Core Features & Use Cases - Quantitative analysis: On R8 9.3.7-dev or later, runs the R8 Configuration Analyzer to generate optimization, shrinking, and obfuscation scores plus per-rule impact metrics. - Heuristic evaluation: On older R8 versions, manually inspects proguard-rules.pro against known redundant library rules (Gson, Retrofit, Room, Coroutines) and a keep-rule impact hierarchy. - Structured report: Outputs a strict Markdown report covering configuration issues, global disable rules, optimization scores, keep rule evaluation, and subsumed rules. - Use Case: A developer notices their release APK is larger than expected. They run this Skill, which flags a package-wide -keep class com.example.models.** { *; } rule blocking optimization of 30% of the codebase and recommends refining it with @SerializedName annotations. ## Quick Start Analyze my Android project's R8 keep rules and proguard configuration to find redundant or overly broad rules hurting app size.

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 in my Android project?

Run an R8 keep rule analysis that compares your proguard-rules.pro against rules already bundled by libraries like Gson, Retrofit, Room, and Kotlin Coroutines. Rules duplicated by library consumer ProGuard files can be safely removed.

How to measure the impact of R8 keep rules on app size?

Use the R8 Configuration Analyzer available in R8 9.3.7-dev or later. It generates a protobuf report during the release build that converts to JSON, yielding optimization, shrinking, and obfuscation scores plus per-rule blast radius metrics.

Does this analysis work with older R8 or AGP versions?

Yes. For R8 versions below 9.3.7-dev, a heuristic path manually inspects proguard-rules.pro against known redundant rule patterns and a keep-rule impact hierarchy, though without quantitative scores.

Why are package-wide keep rules bad for R8 optimization?

Rules like -keep class com.example.** { *; } prevent shrinking, obfuscation, and optimization of every class and member in the package tree. They should be refined to target specific classes or replaced with annotations like @SerializedName.

Can I remove keep rules for Gson and Retrofit?

Yes, if you use Gson 2.11.0+ or Retrofit 2.9.0+, since both bundle their own consumer ProGuard rules. Manual rules for these libraries are redundant and often broader than necessary, blocking R8 from stripping unused code.