How to clear the Gradle cache

Android and JVM builds stash jars and transforms in ~/.gradle. Clearing caches is usually safe; clearing the whole .gradle directory is harsher — know which folder you mean.

These commands permanently delete files. Most are caches the tool rebuilds on its own (the next build or install is slower and may need internet). Anything that can hold data you cannot re-download is flagged on the page. Read each command, then copy and run it yourself. devdisk never runs cleanup commands for you.

Paths that matter

Recommended clear

# Quit Android Studio / Gradle daemons first
rm -rf ~/.gradle/caches/

Or from a project: ./gradlew clean (project only), then optionally wipe the global caches folder above.

Stop daemons first

./gradlew --stop

Stops Gradle daemons so files are not locked mid-delete.

Measure with devdisk

devdisk lists Gradle caches under build caches when present, never deletes, and can emit a cleanup script you review.

curl -fsSLO https://disk.sadana.app/devdisk.py && python3 devdisk.py

Run free scannerSample report

Want one-click cleanup?

A planned devdisk desktop app for Mac and Windows: live treemap, cleanup that moves files to the Trash, scheduled scans. One email when it launches, with an early-supporter price. Your address is used only for that, and every email has an unsubscribe link.

FAQ

Will I need internet after?

Yes — next build re-downloads dependencies. That is expected.

What about Android SDK / emulators?

Separate paths under Android/sdk and AVD folders. Don’t confuse them with Gradle caches; they are larger and slower to restore.

Windows path?

%USERPROFILE%\.gradle\caches

More cleanup guides