How to cache Gradle dependencies

Hi everyone,

interesting and important topic.

I really don’t like the idea that the Gradle Runner step has some internal logic that takes care of what to cache.

Because of that we set cache_level: none for all of these steps and configured the cache-push step to cache_paths: "$HOME/.gradle/caches/". Since the Android plugin migrated to the Gradle caching and the custom AGP cache was removed with 4.1 this should be sufficient.
So we use the same logic that the Gradle docs descripe for local build-cache. You should also be able to tweak Gradles cleanup behaviour this way.

Maybe you try to use the build-cache this way. For my part I can recommend it, even though I also end up manually deleting the cache every now and then.

1 Like