Infrastructure worth keeping — and kept patched.

Does the build cache work with Kotlin and Android builds?

Yes, for a small Kotlin/JVM project and a small Android project. In a repeat build, Gradle took the Kotlin compile tasks, the Java compile and the dex tasks from FosterStack Cache, a server you run yourself, instead of running them again.

The short answer for Kotlin

The short answer for Android

What to do

Our advice, not a test result:

How we checked

We built a small Kotlin project twice in each of three cases, always on a new empty FosterStack Cache server. Build 1 stored the results. Build 2 used a fresh copy of the project. This table shows build 2.

TaskNothing changedBody change in coreNew public function in core
:core:compileKotlinfrom cacheranran
:core:compileJavafrom cachefrom cacheran
:app:compileKotlinfrom cachefrom cacheran
:app:compileTestKotlinfrom cachefrom cacheran
:app:testfrom cacheranran
:core:jar and :app:jarranranran

What: Gradle 9.8.0, the Kotlin Gradle plugin 2.4.21, Temurin 21.0.12.1, FosterStack Cache 0.2.1, on a Mac (arm64). Two modules: core has a Kotlin class and one Java file, app has a Kotlin class and one test and uses core. The command was gradle build.

How: every build used a fresh copy of the project and Gradle's local cache was off. One Gradle home was shared for downloads (the plugin and the test libraries), and it was filled first by a build with the cache off. Tasks with nothing to compile or test are left out. Each case was one run.

Android, on a GitHub-hosted machine. We ran three cases on a small Android project, two builds each. Each case used a new empty cache server. Build 1 stored the results, and build 2 used a fresh copy of the project. This table shows build 2.

CaseTasks restored (of 78)Library Kotlin compileApp Kotlin compile
Nothing changed35from cachefrom cache
Body change in the library31ranfrom cache
New public function in the library29ranran

Android run: a GitHub-hosted machine, Ubuntu 24 image 20261004.327.1, 4 vCPUs (AMD EPYC 7763), 16 GB. The run and its log are public, with every task listed, and the script is bin/bench-android.sh.

What: the Android Gradle plugin 9.4.1, which brings Kotlin support with it, and the Android SDK already on the machine (compile SDK 36, build tools 37.0.0). Gradle 9.8.0, Java 21.0.12.1, FosterStack Cache 0.2.1. The command was assembleDebug. The project is a library module (Kotlin and one Java file) and an app module (Kotlin) that uses it. The plugin and Kotlin compiler are downloaded at run time and are not checksum-pinned.

How: one Gradle home was shared for downloads and Gradle's transform results, and a build with the cache off filled it first. Every build used a fresh copy of the project and no local build cache. Of the 78 tasks, 12 had nothing to run or were already up to date, so they could not be restored. The project is generated and small, with no real dependencies.

Not tested: Android release builds, lint, Android tests, Kotlin Multiplatform, kapt or KSP, Compose, a real-sized app, other plugin versions, Maven. The Kotlin JVM runs were on a Mac and the Android runs on the hosted machine. We make no claim about build times.