r8-analyzer
Qué hace
Esta skill revisa los archivos de compilación de Android y las reglas de conservación de R8 en busca de duplicados y de reglas demasiado amplias. Ayuda a reducir el tamaño de la app y a corregir configuraciones de ProGuard confusas. Es para desarrolladores de Android que gestionan la reducción y la optimización de la app.
Cuándo usarla
- ✓Cuando quieres que tu app de Android ocupe menos limpiando las reglas de conservación de R8.
- ✓Cuando tu configuración de ProGuard o R8 es difícil de entender y quieres que la revisen.
- ✓Cuando quieres comprobar si un Android Gradle Plugin antiguo debe pasar a una configuración más nueva para optimizar la app.
Link de la skill
https://github.com/android/skills/blob/main/performance/r8-analyzer/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Revisa mis reglas de conservación de R8 e indícame cuáles son redundantes o demasiado amplias.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
La skill comprueba los archivos de compilación en busca de la versión de Android Gradle Plugin y los ajustes de R8. Después sigue uno de dos caminos de análisis, según la versión del plugin, para encontrar las reglas redundantes y demasiado amplias.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de GitHub.
Step 1. Setup and configuration check
- Inspect
build.gradle,build.gradle.kts, andgradle.properties. - Use 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 and the Configuration Analyzer task. - Full mode : Verify
android.enableR8.fullMode=falseis removed from thegradle.propertiesfile.
Step 2. Analysis path selection
Inspect
build.gradle,build.gradle.kts,settings.gradle,settings.gradle.kts,gradle.properties, andlibs.versions.tomlto get the AGP and R8 versions. An R8 version pinned insettings.gradle(.kts)replaces the R8 bundled with AGP.Find the app module (usually
app) and a build variant with R8 enabled (usuallyrelease). 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)
- Step 1: Check requirements : Python and the
protobufpackage 6.33.4 or later are mandatory (used byscripts/keep_radius_pb2.py). Install it withpip install "protobuf>=6.33.4"; versions lower than 6.33.4 fail on import with aVersionErrororImportError. - Step 2: Run standalone task on R8-enabled build : For the module and variant you found during path selection, run
./gradlew :<module>:analyze<Variant>R8Config(for example,./gradlew :app:analyzeReleaseR8Config). It generates the report in<module>/build/reports/r8/(for example,app/build/reports/r8/r8-config-analyzer-release.pb). You must wait for this command to finish before proceeding. - Step 3: Convert to JSON : You must explicitly run the conversion script
scripts/convert_pb_to_json.pyaspython3 <skill_dir>/scripts/convert_pb_to_json.pywith arguments<module>/build/reports/r8andtmp/keepradius/keepruleradius.json. Wait for this command to finish. - Step 4: Analyze : You must explicitly run the analysis script
scripts/analyze.pyby executingpython3 <skill_dir>/scripts/analyze.py tmp/keepradius/keepruleradius.json. This outputstmp/keepradius/analysis_result.txt. Wait for this command to finish.
Path B: Invoke R8 release build (AGP < 9.3.0)
- Step 1: Check requirements : Python and the
protobufpackage 6.33.4 or later are mandatory:pip install "protobuf>=6.33.4". - Step 2: Generate and analyze : You must run the shell commands described in references/FULL_BUILD_CONFIG_ANALYZER.md to temporarily update the R8 version in
settings.gradle(.kts)to 9.4.34 or later (so R8 generates the report), generate the proto report intmp/r8analysis/, convert it totmp/r8analysis/keepruleradius.json, analyze the result, and revert the temporarysettings.gradle(.kts)change. - Step 3: Analyze : Verify that the analysis outputs
tmp/r8analysis/analysis_result.txtfor scores and rule impact metrics.
Step 3. Report generation
- Format : Follow references/REPORT_FORMAT.md strictly.
- Redundant rules : Check keep rules against references/INSPECT-RULES.md. If a keep rule matches a pattern in references/INSPECT-RULES.md, include the guidance and remediation from that reference alongside the impact metrics.
- Input : Extract metrics (Scores, Impacts, Example Classes, rule origins) directly from the generated file
tmp/keepradius/analysis_result.txtif using Path A, ortmp/r8analysis/analysis_result.txtif using Path B. - Output : Short progress updates are fine while Gradle runs; the final message is the report only. Output only the raw Markdown report in the chat. Do not output conversational filler (for example, "Here is your report..."). Do not provide recommendations, next steps, or any other text outside of the sections defined in references/REPORT_FORMAT.md.
Preguntas frecuentes
¿Corrige errores generales de compilación de Gradle?
No. Esos quedan fuera de esta skill, que se centra en el tamaño de la app y las reglas de conservación.
¿Qué versión del plugin espera?
Para las versiones 9.3.0 y posteriores usa una tarea independiente. Para las versiones anteriores usa un camino de análisis medido.
¿Comprueba el ajuste de modo completo?
Sí. Comprueba que la antigua marca de modo completo se haya eliminado de gradle.properties.
Detalles
Descripción original del autor
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.
repo: android/skills
Popularidad
- Estrellas en GitHub
- 10 mil
- Posición en el ranking
- #11927
- Licencia
- Apache-2.0
- Actualizada
- 29/10/2026
Comentarios
- …
Más skills de este repositorio
agp-9-upgrade
10 milAyuda a tu agente a actualizar una app de Android a Android Gradle Plugin 9 y a resolver sus cambios incompatibles. No sirve para proyectos multiplataforma.
camerax
10 milAyuda a tu agente a crear funciones de cámara en Android con CameraX, incluida la grabación de vídeo, los controles del hardware y los efectos de ML Kit y Media3.
android-for-cars-parked-apps
10 milAyuda a tu agente a adaptar una app de Android de vídeo, juegos o navegador para que funcione como app aparcada en Android Auto y Android Automotive.
appfunctions
10 milAyuda a tu agente a encontrar los flujos de trabajo clave de una app de Android y a exponerlos como AppFunctions que los agentes de IA y los comandos de voz pueden ejecutar.
Skills parecidas
android-clean-architecture
280 milHace que tu agente organice proyectos de Android de forma eficiente. Estructura el código para facilitar el mantenimiento y el desarrollo de nuevas funciones.
compose-multiplatform-patterns
280 milAyuda a tu agente a usar patrones de Compose Multiplatform y Jetpack Compose en proyectos KMP, incluyendo estado, navegación, temas y rendimiento.
dart-flutter-patterns
280 milHace que tu agente escriba código para apps de Dart y Flutter. Usa patrones modernos para crear apps robustas y fáciles de mantener.