Gradle cache for Android builds

Mustafa AbbanMustafa Abban

You can now enable Gradle caching for your Android builds on EAS. This allows task outputs to be stored and reused between builds. We've observed around a 50% reduction in build times, with plans to continue improving from there!

How it works

Gradle's build cache stores task outputs so that when a task's inputs haven't changed, the result can be reused from cache instead of being recomputed. This is especially effective for projects with many native modules, where the same tasks are repeated across each module and can all be served from cache.

You can verify that caching is working by checking the Run Gradle step in your build logs. Cached tasks will be marked with FROM CACHE:

Get started

Set the EAS_GRADLE_CACHE environment variable to 1 to enable Gradle caching. You can do this from your accounts's environment variables settings, or by specifying it to your eas.json:

Once enabled, the initial build will generate and save the cache, and subsequent builds will restore from it. Cache keys are generated from the hash of your package manager lock file, so the cache is automatically updated as your dependencies change.

What's next

This is the latest addition to our build caching tools, following compiler cache for builds which uses ccache to accelerate C/C++ recompilation. Together, these caching layers can significantly reduce your build times on Android. We'll continue optimizing cache hit rates and plan to extend these improvements to further packages.

If you have any questions or feedback, reach out to us at workflows@expo.io