rcosteira79/android-skills

gradle-build-performance

Use when Android/Gradle builds are slow — diagnosing bottlenecks with build scans, enabling configuration cache, migrating kapt to KSP, fixing cache misses, and optimizing CI/CD build times.

View source

How to use

  1. Copy the installation command and review the source package before installing it in your own agent environment.
  2. Check the source document for required tools, credentials and supported hosts.
  3. Describe your input and desired deliverable; review the output against the source material.
npx skills add https://github.com/rcosteira79/android-skills --skill gradle-build-performance

Before you start

  • Installation does not include a model subscription, API allowance or permission to access your files.
  • Repository stars and installation counts describe activity, not an independent quality or security test.
Original skill document

Rendered from the source repository. Headings, examples, code, tables, links, and referenced images are preserved.

Gradle Build Performance

This reference covers the workflow discipline plus the patterns that move the needle and are easy to get wrong, not the standard knobs (org.gradle.caching, org.gradle.parallel, org.gradle.jvmargs, android.nonTransitiveRClass, kapt → ksp).

Workflow: measure a baseline (clean + incremental) → ./gradlew assembleDebug --scan (or --profile for a no-upload report) → find the slow phase (configuration / execution / dependency resolution) in the Build Scan timeline → apply one optimization at a time → measure again. Batching changes means you never learn what helped.

Configuration phase — the cheapest wins

  • Configuration cache (org.gradle.configuration-cache=true, AGP 8+) skips the entire configuration phase when inputs are unchanged. Start with org.gradle.configuration-cache.problems=warn, move to fail once clean.
  • No I/O during configuration. A file("version.txt").readText(), a network call, or exec {} at configuration time breaks the configuration cache and slows every build — defer it to execution: providers.fileContents(layout.projectDirectory.file("version.txt")).asText.
  • Lazy task registration — tasks.register("x") { … } (configured only if it's in the execution graph), never tasks.create("x") { … } (eager).
  • Convention plugins, not `subprojects {}` / `allprojects {}` — those root-build blocks eagerly evaluate every subproject. Move shared config into convention plugins (see android-skills:android-gradle-logic).

kapt → KSP (mandatory on AGP 9)

KSP is ~2× faster than kapt, and AGP 9 makes the migration mandatory — it has built-in Kotlin support and org.jetbrains.kotlin.kapt is incompatible with it. Migrate to KSP (requires KSP 2.3.1+ on AGP 9; Hilt / Room / Moshi all support it), or fall back to com.android.legacy-kapt (same version as AGP) for annotation processors with no KSP equivalent. See JetBrains' `kotlin-tooling-agp9-migration` skill for the broader AGP 9 mechanics.

Dependency resolution

  • Pin versions — a dynamic 1.0.+ or -SNAPSHOT forces a network resolution check on every build. Pin 1.2.3.
  • Repository order — Gradle checks repositories in declaration order; put the most-used first (google() then mavenCentral(), third-party last).

A reasonable gradle.properties baseline

properties
org.gradle.configuration-cache=true
org.gradle.caching=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx4g -XX:+UseParallelGC
android.nonTransitiveRClass=true

Related by task

from this repository

More skills

All skills
rcosteira79
Community

android-data-layer

Use when implementing the data layer in Android or KMP — the Repository pattern's layered error-propagation model (repository as the error boundary, sealed DataError, Result placement with and without a domain layer) and Room in commonMain (@ConstructedBy, BundledSQLiteDriver, per-target KSP).

installs
1
GitHub stars
155
Updated
Sep 19
rcosteira79
Community

android-debugging

Use when debugging Android or KMP issues — Android-specific techniques covering Logcat, ADB, ANR traces, R8 stack trace decoding, memory leaks, Gradle build failures, and Compose recomposition bugs, on a root-cause-first foundation.

installs
1
GitHub stars
155
Updated
Sep 19
rcosteira79
Community

android-dev

Use this skill as the baseline for ALL Android and Kotlin Multiplatform (KMP) work — whenever the user mentions Android, Kotlin (in an Android context), KMP, CMP, commonMain, androidMain, iosMain, AndroidManifest, Gradle, build.gradle, Hilt, Dagger, Room, Retrofit, Ktor, ViewModel, LiveData, StateFlow, SharedFlow, Compose, Activity, Fragment, Intent, ADB, Logcat, MVVM, MVI, repository pattern, or any Android SDK / Jetpack / AndroidX API. Always load this skill alongside the more specific skills

installs
1
GitHub stars
155
Updated
Sep 19
rcosteira79
Community

android-ux

Use when designing or reviewing Android UI — applies Material Design 3 UX principles covering touch targets, spacing, navigation patterns, accessibility, animation timing, and platform conventions. Includes an M3 compliance audit that scores screens across 10 categories. Complements the compose skill with design-level decisions.

installs
1
GitHub stars
155
Updated
Sep 19