Gradle Build Performance logo

Gradle Build Performance

Community
hanamizuki
gradle-build-performance

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

Overview

Publisherhanamizuki
Repositorysolopreneur
Skill namegradle-build-performance
Stars
150
Forks
9
Bundled files
1
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by hanamizuki on GitHub. Read the source before you install it.

Installation

Install the Gradle Build Performance AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/hanamizuki/solopreneur.git /tmp/solopreneur
mkdir -p .claude/skills
cp -r /tmp/solopreneur/plugins/claude/android-dev/skills/gradle-build-performance .claude/skills/gradle-build-performance
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Gradle Build Performance in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Gradle Build Performance on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Gradle Build Performance is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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

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+):

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

2. Enable Build Cache

Reuses task outputs across builds and machines:

properties
# gradle.properties
org.gradle.caching=true

3. Enable Parallel Execution

Build independent modules simultaneously:

properties
# gradle.properties
org.gradle.parallel=true

4. Increase JVM Heap

Allocate more memory for large projects:

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

5. Use Non-Transitive R Classes

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

properties
# gradle.properties
android.nonTransitiveRClass=true

6. Migrate kapt to KSP

KSP is 2x faster than kapt for Kotlin:

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:

kotlin
// 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:

kotlin
// 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:

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

10. Enable Incremental Annotation Processing

properties
# 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:

kotlin
// 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():

kotlin
// 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

kotlin
// 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:

kotlin
// 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

bash
# 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

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Gradle Build Performance AI skill do?

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

Why use Gradle Build Performance on TypingMind?

Because you install it once and use it with any model. Gradle Build Performance is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Gradle Build Performance in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/hanamizuki/solopreneur/tree/main/plugins/claude/android-dev/skills/gradle-build-performance. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Gradle Build Performance?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Gradle Build Performance?

As many as you like. As long as a model supports skills, you can use Gradle Build Performance with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Gradle Build Performance AI skill free?

Yes. It is published on GitHub by hanamizuki under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇