Speeding up Android CI builds: configuration cache plus build cache on GitHub Actions

Hi, I maintain a small Android companion app for a self-hosted video platform. CI builds on GitHub Actions take around 9 minutes. I’ve enabled org.gradle.caching=true and org.gradle.configuration-cache=true in gradle.properties, but cache hits on CI are low. Is gradle/actions/setup-gradle enough to persist the build cache between runs, or do I need a remote cache node? Any tips welcome!

If you can, enable build scans to maybe see what was out-of-date and why.

If not, you could enable cache debug mode where it logs for each cacheable task which makes it into the cache key and then you can compare the output of two runs to see why cache was not reused maybe.

The build-cache should work ootb iirb, but with some restrictions, read the details at actions/docs/setup-gradle.md at main · gradle/actions · GitHub.

Also there you will find that configuration-cache will not be reused unless you provide an explicit encryption key.