Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
new-silvermoon avatar

Gradle Build Performance

  • 651 installs
  • 910 repo stars
  • Updated July 27, 2026
  • new-silvermoon/awesome-android-agent-skills

gradle-build-performance is a Claude Code skill that automatically diagnoses and optimizes slow Gradle builds in Android projects for developers investigating CI regressions, build scans, and compilation bottlenecks.

About

gradle-build-performance is an Android build optimization skill from new-silvermoon/awesome-android-agent-skills for slow clean and incremental Gradle builds. The skill guides analysis of Gradle Build Scans, separation of configuration versus execution bottlenecks, Configuration Cache enablement, unnecessary recompilation reduction, and kapt/KSP annotation processing debugging. Use it when local or CI Android builds regress, CI/CD times spike, or teams need structured steps to speed Gradle without guesswork. Example prompts include analyzing build scans, enabling configuration cache, and reducing kapt overhead.

  • Automatically profiles Gradle build performance bottlenecks
  • Generates actionable optimization recommendations for Android agent workflows
  • Reduces incremental build times by identifying unnecessary tasks and dependency issues
  • Works with Claude Code and Cursor on Android agent repositories
  • Outputs concrete configuration changes and command flags

Gradle Build Performance by the numbers

  • 651 all-time installs (skills.sh)
  • +17 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #231 of 1,435 DevOps & CI/CD skills by installs in the Skillselion catalog
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/new-silvermoon/awesome-android-agent-skills --skill gradle-build-performance

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs651
repo stars910
Last updatedJuly 27, 2026
Repositorynew-silvermoon/awesome-android-agent-skills

How do you speed up slow Android Gradle builds?

Automatically diagnose and optimize slow Gradle builds in Android projects.

Who is it for?

Android developers and CI owners debugging slow Gradle builds, build scan regressions, or annotation processing overhead.

Skip if: iOS Xcode builds or non-Android JVM projects without Gradle build performance issues.

When should I use this skill?

Android or Gradle builds are slow, CI times regressed, or build scans show configuration or compilation bottlenecks.

What you get

Build scan findings, configuration cache settings, recompilation fixes, and kapt/KSP optimization recommendations

  • Optimization recommendations
  • Configuration cache settings
  • Bottleneck analysis

Files

SKILL.mdMarkdownGitHub ↗

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

./gradlew assembleDebug --scan

Profile Build Locally

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

Build Timing Summary

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

---

Build Phases

PhaseWhat HappensCommon Issues
Initializationsettings.gradle.kts evaluatedToo many include() statements
ConfigurationAll build.gradle.kts files evaluatedExpensive plugins, eager task creation
ExecutionTasks run based on inputs/outputsCache misses, non-incremental tasks

Identify the Bottleneck

Build scan → Performance → Build timeline
  • Long configuration phase: Focus on plugin and buildscript optimization
  • Long execution phase: Focus on task caching and parallelization
  • Dependency resolution slow: Focus on repository configuration

---

12 Optimization Patterns

1. Enable Configuration Cache

Caches configuration phase across builds (AGP 8.0+):

# gradle.properties
org.gradle.configuration-cache=true
org.gradle.configuration-cache.problems=warn

2. Enable Build Cache

Reuses task outputs across builds and machines:

# gradle.properties
org.gradle.caching=true

3. Enable Parallel Execution

Build independent modules simultaneously:

# gradle.properties
org.gradle.parallel=true

4. Increase JVM Heap

Allocate more memory for large projects:

# gradle.properties
org.gradle.jvmargs=-Xmx4g -XX:+UseParallelGC

5. Use Non-Transitive R Classes

Reduces R class size and compilation (AGP 8.0+ default):

# gradle.properties
android.nonTransitiveRClass=true

6. Migrate kapt to KSP

KSP is 2x faster than kapt for Kotlin:

// Before (slow)
kapt("com.google.dagger:hilt-compiler:2.51.1")

// After (fast)
ksp("com.google.dagger:hilt-compiler:2.51.1")

7. Avoid Dynamic Dependencies

Pin dependency versions:

// BAD: Forces resolution every build
implementation("com.example:lib:+")
implementation("com.example:lib:1.0.+")

// GOOD: Fixed version
implementation("com.example:lib:1.2.3")

8. Optimize Repository Order

Put most-used repositories first:

// settings.gradle.kts
dependencyResolutionManagement {
    repositories {
        google()      // First: Android dependencies
        mavenCentral() // Second: Most libraries
        // Third-party repos last
    }
}

9. Use includeBuild for Local Modules

Composite builds are faster than project() for large monorepos:

// settings.gradle.kts
includeBuild("shared-library") {
    dependencySubstitution {
        substitute(module("com.example:shared")).using(project(":"))
    }
}

10. Enable Incremental Annotation Processing

# gradle.properties
kapt.incremental.apt=true
kapt.use.worker.api=true

11. Avoid Configuration-Time I/O

Don't read files or make network calls during configuration:

// BAD: Runs during configuration
val version = file("version.txt").readText()

// GOOD: Defer to execution
val version = providers.fileContents(file("version.txt")).asText

12. Use Lazy Task Configuration

Avoid create(), use register():

// BAD: Eagerly configured
tasks.create("myTask") { ... }

// GOOD: Lazily configured
tasks.register("myTask") { ... }

---

Common Bottleneck Analysis

Slow Configuration Phase

Symptoms: Build scan shows long "Configuring build" time

Causes & Fixes:

CauseFix
Eager task creationUse tasks.register() instead of tasks.create()
buildSrc with many dependenciesMigrate to Convention Plugins with includeBuild
File I/O in build scriptsUse providers.fileContents()
Network calls in pluginsCache results or use offline mode

Slow Compilation

Symptoms: :app:compileDebugKotlin takes too long

Causes & Fixes:

CauseFix
Non-incremental changesAvoid build.gradle.kts changes that invalidate cache
Large modulesBreak into smaller feature modules
Excessive kapt usageMigrate to KSP
Kotlin compiler memoryIncrease kotlin.daemon.jvmargs

Cache Misses

Symptoms: Tasks always rerun despite no changes

Causes & Fixes:

CauseFix
Unstable task inputsUse @PathSensitive, @NormalizeLineEndings
Absolute paths in outputsUse relative paths
Missing @CacheableTaskAdd annotation to custom tasks
Different JDK versionsStandardize JDK across environments

---

CI/CD Optimizations

Remote Build Cache

// settings.gradle.kts
buildCache {
    local { isEnabled = true }
    remote<HttpBuildCache> {
        url = uri("https://cache.example.com/")
        isPush = System.getenv("CI") == "true"
        credentials {
            username = System.getenv("CACHE_USER")
            password = System.getenv("CACHE_PASS")
        }
    }
}

Gradle Enterprise / Develocity

For advanced build analytics:

// settings.gradle.kts
plugins {
    id("com.gradle.develocity") version "3.17"
}

develocity {
    buildScan {
        termsOfUseUrl.set("https://gradle.com/help/legal-terms-of-use")
        termsOfUseAgree.set("yes")
        publishing.onlyIf { System.getenv("CI") != null }
    }
}

Skip Unnecessary Tasks in CI

# Skip tests for UI-only changes
./gradlew assembleDebug -x test -x lint

# Only run affected module tests
./gradlew :feature:login:test

---

Android Studio Settings

File → Settings → Build → Gradle

  • Gradle JDK: Match your project's JDK
  • Build and run using: Gradle (not IntelliJ)
  • Run tests using: Gradle

File → Settings → Build → Compiler

  • Compile independent modules in parallel: ✅ Enabled
  • Configure on demand: ❌ Disabled (deprecated)

---

Verification Checklist

After optimizations, verify:

  • [ ] Configuration cache enabled and working
  • [ ] Build cache hit rate > 80% (check build scan)
  • [ ] No dynamic dependency versions
  • [ ] KSP used instead of kapt where possible
  • [ ] Parallel execution enabled
  • [ ] JVM memory tuned appropriately
  • [ ] CI remote cache configured
  • [ ] No configuration-time I/O

---

References

Related skills

How it compares

Pick gradle-build-performance for Android Gradle-specific bottlenecks; general CI skills lack kapt, KSP, and Configuration Cache guidance.

FAQ

What does gradle-build-performance optimize?

gradle-build-performance diagnoses slow Android Gradle builds: Build Scan analysis, configuration versus execution bottlenecks, Configuration Cache tuning, unnecessary recompilation, and kapt/KSP annotation processing overhead in local and CI pipelines.

When should Android teams use gradle-build-performance?

Android teams should use gradle-build-performance when clean or incremental builds are slow, CI/CD times regress, or Build Scans show compilation or configuration bottlenecks—not for iOS or non-Gradle projects.

DevOps & CI/CDintegrationsdevops

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.