r8-analyzer

Analyze Android build files and R8 keep rules to identify redundant directives.

2|Updated May 12, 2026
One-click install
npx skills add https://github.com/youfengknight/Android-Code-Skills --skill r8-analyzer-youfengknight
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: r8-analyzer
Source: https://github.com/youfengknight/Android-Code-Skills/tree/main/android-skills/performance/r8-analyzer
Command: npx skills add https://github.com/youfengknight/Android-Code-Skills --skill r8-analyzer-youfengknight

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you diagnose and fix bloated or overly broad R8/Proguard keep rules so R8 can safely shrink and optimize your Android app without losing required code.

Core Features & Use Cases

  • Build configuration review: Checks your build.gradle/build.gradle.kts and gradle.properties settings (including AGP/R8 optimization flags) to ensure the project is configured for effective optimization.
  • Keep-rule auditing: Evaluates each keep rule in a structured order to spot redundant rules, overly broad package-wide patterns, and rules that subsume others.
  • Reflection-driven refinement: Identifies where reflection likely drives the need for keep rules and guides you toward narrower, scenario-specific rules (especially in packages where reflection exists).
  • Impact-based reordering and guidance: Produces a prioritized recommendation sequence and tells you what to remove or refine so that the final rule set is tighter and safer.

Quick Start

Run the r8-analyzer skill on your codebase to generate R8 keep-rule analysis and actionable refinement guidance for each redundant or overly broad rule.

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 R8 keep rules that are preventing APK shrinking?

To find redundant R8 keep rules blocking APK shrinking, audit keep directives by evaluating impact hierarchy and subsuming patterns, identifying overly broad package-wide rules that prevent code removal. This generates prioritized removal instructions without modifying keep files.

What is the best way to tighten Proguard keep rules for reflection scenarios?

Tightening Proguard keep rules for reflection requires identifying where reflection drives the need for kept classes, then guiding toward narrower, scenario-specific rules in affected packages. This reflection-driven refinement produces a safer final rule set.

Does this R8 analyzer work with both Groovy and Kotlin DSL build files?

R8 troubleshooting applies across Gradle Groovy and Kotlin DSL build files, inspecting build.gradle or build.gradle.kts and gradle.properties to target AGP/R8 optimization misconfigurations and incorrect keep-rule patterns.

Why is my R8 keep rule subsuming other rules and blocking optimization?

R8 keep rules subsume others when overly broad package-wide patterns encompass narrower directives, blocking optimization. Auditing rules via impact hierarchy classification reveals subsuming patterns and generates precise refinement guidance to resolve the issue.

Can I review gradle.properties and build.gradle settings for R8 shrink optimization misconfigurations?

Review build.gradle and gradle.properties settings for R8 shrink optimization misconfigurations by inspecting AGP/R8 optimization flags, ensuring effective project configuration for safe code shrinking and optimization.

What are the limitations of automated R8 keep rule analysis for APK size reduction?

R8 keep rule analysis for APK size reduction is limited to inspecting build configuration and classifying keep rules without modifying keep files, providing removal or refinement instructions that users must manually apply to ensure safety.