CleanMate

All guides · macOS and Ubuntu · Updated

Android Studio using too much disk space: old SDK and NDK, emulator images and the Gradle cache on Mac and Ubuntu

Where Android Studio puts its tens of GB on a Mac and on Ubuntu and how to remove what you no longer need: old NDK, build-tools and platforms with sdkmanager, system images and AVDs with avdmanager, emulator snapshots, the Gradle cache and old Android Studio versions.

Download for macOS · Install on Ubuntu — free and open source

CleanMate on a Mac after a Smart Scan cleanup that removed Android Studio caches, showing the space freed per groupCleanMate on a Mac after a Smart Scan cleanup that removed Android Studio caches, showing the space freed per group

Android Studio is a small download and a large habit. Every time the SDK Manager offers an update, it installs the new version next to the old one and never removes the old one. A year of updates leaves five NDKs of 1 to 4 GB each, a dozen build-tools, platforms for every API level you once targeted, and an emulator image for each phone you tested. Add the Gradle cache and a few abandoned virtual devices, and 60 GB is normal.

Start by measuring. The commands work on both systems, the paths are the ones listed in each section:

# Mac
du -sh ~/Library/Android/sdk ~/.android ~/.gradle ~/Library/Application\ Support/Google 2>/dev/null
# Ubuntu
du -sh ~/Android/Sdk ~/.android ~/.gradle ~/.config/Google ~/.cache/Google 2>/dev/null

If you moved the SDK, its place is in ANDROID_HOME (or ANDROID_SDK_ROOT), and in Settings > Languages & Frameworks > Android SDK. Quit Android Studio, running emulators and Gradle builds before you delete anything below.

The SDK folder: NDK, build-tools, platforms, CMake

The SDK lives in ~/Library/Android/sdk on a Mac and ~/Android/Sdk on Ubuntu. Inside, these folders collect versions:

The folders you must not touch are platform-tools, emulator and licenses.

Remove versions through the SDK Manager’s command line, so its records stay correct:

~/Library/Android/sdk/cmdline-tools/latest/bin/sdkmanager --list_installed
~/Library/Android/sdk/cmdline-tools/latest/bin/sdkmanager --uninstall "ndk;26.1.10909125" "build-tools;33.0.2" "platforms;android-33"

On Ubuntu use ~/Android/Sdk/cmdline-tools/latest/bin/sdkmanager. The same can be done in Settings > Languages & Frameworks > Android SDK, with Show Package Details ticked on the SDK Platforms and SDK Tools tabs.

The rule to follow: keep the newest version of each kind, and keep every version one of your projects pins. A project pins a version with ndkVersion, buildToolsVersion or compileSdk in its build.gradle or build.gradle.kts, or ndk.dir in local.properties. Search for them before you delete:

grep -rn --include=build.gradle --include=build.gradle.kts --include=local.properties \
  -E "ndkVersion|buildToolsVersion|compileSdk|ndk.dir" ~/Developer 2>/dev/null

Replace ~/Developer with where your projects live. If you remove a version a project needs, Gradle downloads it again the next time you build, so the cost of a mistake is a download.

Emulator system images

Each system image sits in system-images/<android-N>/<tag>/<abi> inside the SDK, and is often 1 to 8 GB. Deleting a virtual device (AVD) does not delete its image, so images pile up long after the devices are gone.

sdkmanager --list_installed | grep system-images
sdkmanager --uninstall "system-images;android-34;google_apis;arm64-v8a"

Before you delete one, check which images your devices use. Each device has a config.ini that names its image in image.sysdir.1:

grep -H image.sysdir ~/.android/avd/*.avd/config.ini

An image no device names is safe to remove; the SDK Manager downloads it again when you need it.

Virtual devices and their snapshots

Virtual devices live in ~/.android/avd, one <name>.avd folder each (ANDROID_AVD_HOME can move them). The folder holds the device’s disk image, which grows as you install apps. The snapshots folder inside it holds the quick-boot snapshots, often several GB per device, and the next start of the device is only slower without them (a cold boot); its apps and data stay.

avdmanager list avd
avdmanager delete avd -n Pixel_6_API_34
du -sh ~/.android/avd/*.avd/snapshots
rm -r ~/.android/avd/Pixel_6_API_34.avd/snapshots

Quit the emulator first. avdmanager delete avd removes the device completely, including its data, so use it only for devices you will not boot again.

The Gradle cache and wrapper downloads

Gradle keeps everything it downloads in ~/.gradle:

Stop the daemons before deleting, or they recreate files while you work:

./gradlew --stop        # or: gradle --stop
du -sh ~/.gradle/caches ~/.gradle/wrapper/dists/*
rm -r ~/.gradle/caches

The next build downloads the dependencies it needs, so the first build after a cleanup is slow and needs network. For the wrapper, delete only the version folders of Gradle releases no project uses any more. If you set GRADLE_USER_HOME, the folder is there instead of ~/.gradle.

Old Android Studio versions

Every Android Studio release creates its own settings, caches and logs, named after the version, for example AndroidStudio2025.1. An upgrade does not remove the old ones, and the caches alone are often a few GB.

Keep the folders of the version you run and delete older ones once you have confirmed the newer one has your settings. JetBrains IDEs (IntelliJIdea2025.1, GoLand2025.3, PyCharm...) leave the same trail in their own folders.

How CleanMate does it

CleanMate puts these items in the developer junk of Smart Scan, with their sizes, on a Mac (all macOS features) and on Ubuntu (all Ubuntu features). Nothing is removed until you confirm, and the items below are never ticked for you.

SDK components and system images are deleted rather than moved to the Trash, because the SDK Manager downloads them again. The desktop app on Ubuntu lists each version and each image on its own row too.

If your disk is still full after this, the next suspects are Xcode (Xcode using too much space), containers (Docker using too much disk space) and the rest of the developer caches (Free up disk space on a Mac as a developer or on Ubuntu). To compare what CleanMate does with other cleaners, see the comparison. JetBrains IDEs and VS Code are in their own guide. Maven and the Gradle cache of other Java and Kotlin projects are covered in Rust, Go and Java package caches, and Unity’s Android build support in Unity using too much disk space.

For mobile projects, see Flutter, React Native and the iOS Simulator filling your Mac.

FAQ

Is it safe to delete old NDK versions? Yes, if no project pins them. Gradle or the SDK Manager downloads a version again when a build asks for it, so the cost of a mistake is a download of 1 to 4 GB.

Why is the Android Studio folder so large when I just installed it? The application itself is under 2 GB. The space is in the SDK folder, the emulator images, ~/.android and ~/.gradle, which Android Studio creates outside the application.

Can I delete ~/.gradle/caches safely? Yes. It is a cache; the next build downloads what it needs. Run gradle --stop first and expect one slow build.

Does deleting a virtual device free its system image? No. The image is a separate SDK package. Remove it with sdkmanager --uninstall or let a cleaner list the images no device uses.

Skip the commands

CleanMate runs on both systems: pick yours.

Open source — star it on GitHub: CleanMate for macOS · CleanMate for Ubuntu

How CleanMate decides what is safe to remove →