Skip to content
Menu
DevSecOps Now!!!
  • About
  • Certifications
  • Contact
  • Courses
  • DevSecOps Consulting
  • DevSecOps Tools
  • Training
  • Tutorials
DevSecOps Now!!!

Complete Guide to Cleaning Up Gradle and Flutter Caches on Windows

Posted on October 29, 2025

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

If you develop Android or Flutter apps on Windows, chances are your C:\Users\<username>\.gradle folder has quietly grown to consume tens of gigabytes. It’s normal — Gradle stores downloaded dependencies, compiled caches, and temporary build files there.
But after months (or years) of active development, you can reclaim 10–35 GB of space safely without breaking your setup.

This tutorial explains, step-by-step, how to safely clean up Gradle and Flutter caches, understand what each folder does, and use simple scripts to automate it.


Locating the .gradle Directory

On Windows, the Gradle home directory lives here:

C:\Users\<your-username>\.gradle

In your case:

C:\Users\ashwa\.gradle

When you open it, you’ll see folders such as:

.tmp
android
caches
daemon
jdks
kotlin-profile
native
notifications
workers
wrapper
android.lock

Each of these has a purpose — some can be safely deleted, others should remain.


Understanding Each Folder (and What’s Safe to Delete)

FolderPurposeCan I Delete It?Notes
.tmpTemporary Gradle files✅ SafeWill be recreated automatically
cachesStores old build caches, plugin downloads, dependency jars✅ SafeFrees 10–20 GB
daemonBackground Gradle processes✅ SafeStop Gradle first (gradle --stop)
nativeNative build artifacts✅ SafeRegenerated when needed
workersMetadata about worker threads✅ SafeRecreated automatically
jdksGradle-downloaded JDKs⚠️ Partially safeKeep one version currently in use
androidAndroid build system files⚠️ KeepNeeded if you build Android apps
wrapperGradle wrapper distributions❌ KeepUsed for project version matching
notificationsBuild-related notifications✅ SafeRecreated as needed
android.lockLock file✅ SafeUsually 0 KB; harmless to delete

Cleaning Gradle Caches Safely

Before deleting anything, close Android Studio, VS Code, and all Flutter terminals to prevent Gradle from running in the background.

Option A — Command-Line Cleanup (Recommended)

Open PowerShell or Command Prompt:

# Stop all Gradle daemons
gradle --stop

# Remove unnecessary Gradle folders
rd /s /q "%USERPROFILE%\.gradle\caches"
rd /s /q "%USERPROFILE%\.gradle\daemon"
rd /s /q "%USERPROFILE%\.gradle\native"
rd /s /q "%USERPROFILE%\.gradle\workers"
rd /s /q "%USERPROFILE%\.gradle\.tmp"

Gradle will rebuild everything it needs automatically the next time you build a project.


Option B — Manual Deletion

If you prefer a graphical approach:

  1. Open C:\Users\ashwa\.gradle in File Explorer.
  2. Select and delete the folders: caches daemon native workers .tmp
  3. Empty the Recycle Bin.

That’s it — your next Gradle or Flutter build will recreate the necessary files.


How Gradle and Flutter Rebuild Caches Automatically

When you delete .gradle\caches and .gradle\.tmp, Gradle doesn’t lose critical project data — it simply removes downloaded and compiled artifacts.
At your next build or flutter run, Gradle:

  • Checks which dependencies are needed.
  • Re-downloads them from Maven or Google repositories.
  • Re-compiles and caches them locally again.

This first build after cleanup might take a bit longer (since it’s downloading fresh artifacts), but everything remains 100 % functional.


Cleaning Flutter-Specific Caches

Flutter maintains its own package and build cache separately.
To clear it:

flutter clean
flutter pub cache repair

If you want a deeper cleanup:

rd /s /q "%APPDATA%\Pub\Cache\git"
rd /s /q "%APPDATA%\Pub\Cache\hosted"

These commands remove old package versions from your Dart/Flutter cache.


Managing Old Gradle Versions in the Wrapper

You may also notice inside:

C:\Users\ashwa\.gradle\wrapper\dists

that there are many folders like:

gradle-5.4.1-all
gradle-6.8-all
gradle-7.6.3-bin
gradle-8.10-all
gradle-8.12-all
...

Each folder corresponds to a Gradle version downloaded by your projects’ wrappers.
Every project includes a file:

<project>\gradle\wrapper\gradle-wrapper.properties

Inside, you’ll find a line like:

distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip

This tells you which version your project uses.

If all your current projects use Gradle 8.x, you can safely delete older 5.x, 6.x, 7.x folders. Gradle will re-download any missing version automatically if a project requires it later.


PowerShell Script to Automate Cleanup

You can create a script cleanup-gradle.ps1 that performs the cleanup automatically:

Write-Host "Stopping Gradle daemons..."
gradle --stop 2>$null

$paths = @(
  "$env:USERPROFILE\.gradle\caches",
  "$env:USERPROFILE\.gradle\daemon",
  "$env:USERPROFILE\.gradle\native",
  "$env:USERPROFILE\.gradle\workers",
  "$env:USERPROFILE\.gradle\.tmp"
)

foreach ($p in $paths) {
  if (Test-Path $p) {
    Write-Host "Removing $p"
    Remove-Item -Recurse -Force $p
  }
}

Write-Host "Gradle cleanup complete ✅"

To run it:

  1. Save the script as cleanup-gradle.ps1.
  2. Right-click → Run with PowerShell.
  3. Wait for it to finish.

This script only removes safe folders — you keep your Android, wrapper, and JDK files intact.


Cleaning Up Old Gradle Distributions Automatically

To go further, here’s an advanced PowerShell snippet that deletes all old Gradle versions (below 8.x) or unused ones automatically:

# Adjust this to where your projects are located
$Root = "C:\Users\ashwa"

gradle --stop 2>$null

# Detect versions actually in use by your projects
$wrappers = Get-ChildItem -Path $Root -Filter gradle-wrapper.properties -Recurse -ErrorAction SilentlyContinue
$inUse = [System.Collections.Generic.HashSet[string]]::new()
$wrappers | ForEach-Object {
  $text = Get-Content $_.FullName -Raw
  if ($text -match 'gradle-([0-9]+\.[0-9]+(\.[0-9]+)?)\-(all|bin)\.zip') {
    $null = $inUse.Add($Matches[1])
  }
}

Write-Host "Gradle versions referenced by your projects:" ($inUse | Sort-Object)

$dists = Join-Path $env:USERPROFILE ".gradle\wrapper\dists"
$toDelete = Get-ChildItem $dists -Directory | Where-Object {
  if ($_.Name -match 'gradle-([0-9]+)\.([0-9]+)(\.[0-9]+)?-') {
    $major = [int]$Matches[1]
    $ver = "$($Matches[1]).$($Matches[2])"
    -not $inUse.Contains($ver) -or $major -lt 8
  }
}

# Preview first
$toDelete | Select-Object -ExpandProperty FullName
# Remove -WhatIf to actually delete
$toDelete | ForEach-Object { Remove-Item $_.FullName -Recurse -Force -WhatIf }

Run once with -WhatIf to preview, then again without it to delete for real.


Extra Space-Saving Tips for Developers

To reclaim even more space:

ComponentTypical LocationSafe Cleanup Action
Android SDK%LOCALAPPDATA%\Android\SdkDelete old system images & unused build-tools
Temp files%LOCALAPPDATA%\TempUse Disk Cleanup or manually delete
npm cache%APPDATA%\npm-cachenpm cache clean --force
VS Code cache%APPDATA%\Code\CacheSafe to delete
Docker imagesif you use Dockerdocker system prune -a

Expected Space Savings

Cleanup TypeApprox. Space Recovered
.gradle\caches10–20 GB
Flutter pub cache1–5 GB
Android SDK cleanup5–10 GB
Windows temp & others2–5 GB

Total potential reclaimed: 20–35 GB.


After Cleanup — What to Expect

  • First Gradle or Flutter build will take longer since dependencies are re-downloaded.
  • After the first build, performance returns to normal.
  • All deleted folders will reappear as Gradle rebuilds what’s needed.
  • You’ll enjoy a lighter, cleaner development environment with plenty of disk space reclaimed.

Summary

Cleaning Gradle and Flutter caches is completely safe as long as you understand what each folder does.
You can always delete:

  • .gradle\caches
  • .gradle\.tmp
  • .gradle\daemon
  • .gradle\native
  • .gradle\workers
  • Old Gradle versions (5.x, 6.x, 7.x) under .gradle\wrapper\dists

Gradle and Flutter will automatically restore anything necessary.
Performing this maintenance once every few months is a great habit for keeping your Windows development machine healthy and responsive.

Post Views: 2,080
  • Cleaning Flutter-Specific Caches
  • Cleaning Gradle and Flutter Caches on Windows
  • Cleaning Gradle Caches
  • Cleaning Up Gradle
  • Cleaning Up Gradle and Flutter Caches on Windows
  • flutter
  • Flutter Caches
  • Gradle
  • Gradle and Flutter Caches
  • Gradle and Flutter Rebuild Caches
  • Gradle and Flutter Rebuild Caches Automatically
  • PowerShell Script to Automate Cleanup
Subscribe
Login
Notify of
guest
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
  • Certified Site Reliability Architect: The Complete Career Guide
  • What Is a VPN? A Complete Beginner-to-Advanced Tutorial
  • How to Install, Secure, and Tune MySQL 8.4 on Ubuntu 24.04 for Apache Event MPM and PHP-FPM
  • Complete Guide to Certified Site Reliability Engineer Career
  • Certified DevSecOps Professional Step by Step
  • Certified DevSecOps Manager: Complete Career Guide
  • Certified DevSecOps Engineer: Skills, Career Path and Certification Guide
  • Step-by-Step: Become a Certified DevSecOps Architect
  • Tuning PHP 8.3 for Apache Event MPM and PHP-FPM on Ubuntu: A Complete Step-by-Step Production Guide
  • Complete Step-by-Step Guide to Configure Apache Event MPM, Create index.php, Set Up VirtualHost, and Fix Ubuntu Default Page
  • Convert XAMPP Apache to Event MPM + System PHP-FPM
  • The Gateway to System Observability Engineering (MOE)
  • How to Finetune Apache and Prove It Works: A Real-World Guide to Testing Performance, Concurrency, HTTP/2, Memory, CPU, and Security
  • Building a High-Performance Apache Event MPM + PHP-FPM + MariaDB Stack (Advanced Server Optimization Guide)
  • Master Infrastructure as Code: The Complete Hashicorp Terraform Associate Guide
  • Building a High-Performance Apache Server with Event MPM + PHP-FPM (Step-by-Step Guide)
  • Is XAMPP Safer for Production Than Using Apache and PHP as Root? 2026 Practical Guide
  • Unlock Cloud Security Expertise with Certified Kubernetes Security Specialist (CKS)
  • How to Fix wpDiscuz Not Replacing Default WordPress Comments in Block Themes
  • Complete Guide to Certified Kubernetes Application Developer Certification
  • Overview of Certified Kubernetes Administrator (CKA) Certification
  • How to Install and Configure XAMPP on Ubuntu 24 Server (Latest Version – 2026 Complete Guide)
  • Mastering the Google Cloud Professional DevOps Engineer
  • Mastering Azure Cloud Security: The AZ-500 Path
  • Why AZ-400 is Essential for Global Cloud Engineering Roles
  • Webp format is not supported by PHP installation.
  • Reconfigure PHP 8.2.12 for XAMPP WITH WebP
  • How to Fix “WebP Format is Not Supported by PHP Installation” in XAMPP/LAMPP (Complete 2026 Guide)
  • Fixing WebP Format Is Not Supported by PHP Installation in XAMPP (Ubuntu 24) – Complete Step-by-Step Guide
  • Azure Solutions Architect Advice for Senior Leads

Recent Comments

  1. digital banking on Complete Tutorial: Setting Up Laravel Telescope Correctly (Windows + XAMPP + Custom Domain)
  2. SAHIL DHINGRA on How to Uninstall Xampp from your machine when it is not visible in Control panel programs & Feature ?
  3. Abhishek on MySQL: List of Comprehensive List of approach to secure MySQL servers.
  4. Kristina on Best practices to followed in .httacess to avoid DDOS attack?
  5. Roshan Jha on Git all Commands

Archives

  • March 2026
  • February 2026
  • January 2026
  • December 2025
  • November 2025
  • October 2025
  • September 2025
  • August 2025
  • July 2025
  • June 2025
  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022

Categories

  • Ai
  • AI Blogging
  • AiOps
  • ajax
  • Android Studio
  • Antimalware
  • Antivirus
  • Apache
  • Api
  • API Security
  • Api Testing
  • APK
  • Aws
  • Bike Rental Services
  • ChatGPT
  • Code Linting
  • Composer
  • cPanel
  • Cyber Threat Intelligence
  • Cybersecurity
  • Data Loss Prevention
  • Database
  • dataops
  • Deception Technology
  • DeepSeek
  • Devops
  • DevSecOps
  • DevTools
  • Digital Asset Management
  • Digital Certificates
  • Docker
  • Drupal
  • emulator
  • Encryption Tools
  • Endpoint Security Tools
  • Error
  • facebook
  • Firewalls
  • Flutter
  • git
  • GITHUB
  • Google Antigravity
  • Google play console
  • Google reCAPTCHA
  • Gradle
  • Guest posting
  • health and fitness
  • IDE
  • Identity and Access Management
  • Incident Response
  • Instagram
  • Intrusion Detection and Prevention Systems
  • jobs
  • Joomla
  • Keycloak
  • Laravel
  • Law News
  • Lawyer Discussion
  • Legal Advice
  • Linkedin
  • Linkedin Api
  • Linux
  • Livewire
  • Medical Tourism
  • MlOps
  • MobaXterm
  • Mobile Device Management
  • Multi-Factor Authentication
  • MySql
  • Network Traffic Analysis tools
  • Paytm
  • Penetration Testing
  • php
  • PHPMyAdmin
  • Pinterest Api
  • Quora
  • SAST
  • SecOps
  • Secure File Transfer Protocol
  • Security Analytics Tools
  • Security Auditing Tools
  • Security Information and Event Management
  • Seo
  • Server Management Tools
  • Single Sign-On
  • Site Reliability Engineering
  • soft 404
  • software
  • SuiteCRM
  • SysOps
  • Threat Model
  • Twitter
  • Twitter Api
  • ubuntu
  • Uncategorized
  • Virtual Host
  • Virtual Private Networks
  • VPNs
  • Vulnerability Assessment Tools
  • Web Application Firewalls
  • Windows Processor
  • Wordpress
  • WSL (Windows Subsystem for Linux)
  • X.com
  • Xampp
  • Youtube
©2026 DevSecOps Now!!! | WordPress Theme: EcoCoded
wpDiscuz