# Gradle Build Performance

Debug and optimize Android/Gradle build performance.

- Repository: https://github.com/new-silvermoon/awesome-android-agent-skills (998 stars)
- Category: Testing
- License: Apache-2.0
- Last updated: 2026-07-27
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add new-silvermoon/awesome-android-agent-skills --skill gradle-build-performance -g -a claude-code -y`
Codex: `npx skills add new-silvermoon/awesome-android-agent-skills --skill gradle-build-performance -g -a codex -y`
Cursor: `npx skills add new-silvermoon/awesome-android-agent-skills --skill gradle-build-performance -g -a cursor -y`
Gemini CLI: `npx skills add new-silvermoon/awesome-android-agent-skills --skill gradle-build-performance -g -a gemini-cli -y`

## Description

Debug and optimize Android/Gradle build performance. Use when builds are slow, investigating CI/CD performance, analyzing build scans, or identifying compilation bottlenecks.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Gradle Build Performance

## When to Use

- Build times are slow (clean or incremental)
- Investigating build performance regressions
- Analyzing Gradle Build Scans
- Identifying configuration vs execution bottlenecks
- Optimizing CI/CD build times
- Enabling Gradle Configuration Cache
- Reducing unnecessary recompilation
- Debugging kapt/KSP annotation processing

## Example Prompts

- "My builds are slow, how can I speed them up?"
- "How do I analyze a Gradle build scan?"
- "Why is configuration taking so long?"
- "Why does my project always recompile everything?"
- "How do I enable configuration cache?"
- "Why is kapt so slow?"

---

## Workflow

1. **Measure Baseline**, Clean build + incremental build times
2. **Generate Build Scan**, `./gradlew assembleDebug --scan`
3. **Identify Phase**, Configuration? Execution? Dependency resolution?
4. **Apply ONE optimization**, Don't batch changes
5. **Measure Improvement**, Compare against baseline
6. **Verify in Build Scan**, Visual confirmation

---

## Quick Diagnostics

### Generate Build Scan

```bash
./gradlew assembleDebug --scan
```

### Profile Build Locally

```bash
./gradlew assembleDebug --profile
# Opens report in build/reports/profile/
```

### Build Timing Summary

```bash
./gradlew assembleDebug --info | grep -E "^\:.*"
# Or view in Android Studio: Build > Analyze APK Build
```

---

## Build Phases

| Phase | What Happens | Common Issues |
|-------|--------------|---------------|
| **Initialization** | `settings.gradle.kts` evaluated | Too many `include()` statements |
| **Configuration** | All `build.gradle.kts` files evaluated | Expensive plugins, eager task creation |
| **Execution** | Tasks run based on inputs/outputs | Cache misses, non-incremental tasks |

### Identify the Bottleneck

```
Build scan → Performance → Build timeline
```

The rest: https://github.com/new-silvermoon/awesome-android-agent-skills/blob/HEAD/.github/skills/performance/gradle-build-performance/SKILL.md
