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: 3,391
  • 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
  • DevSecOps in Modern Software Engineering: A Comprehensive Guide for Professionals
  • Laravel Posts Installation Guide
  • Strategies to Align DevSecOps With Agile and DevOps Practices
  • How to Fix Laravel Migration Error: Field ‘id’ Doesn’t Have a Default Value in the Migrations Table
  • A Practical Guide to Proving DevSecOps Business Value for Engineering Leaders
  • Mastering Secure Software Delivery by Solving DevSecOps Adoption Challenges
  • Operationalizing Security for Faster and Safer Software Deployments
  • DevSecOps Server Security Checklist 2026: 50 Must-Check Points Before Going Live
  • The Complete DevOps Salary Overview for IT Professionals
  • The Modern DevOps Certification Guide: Roadmaps for Every Engineering Role
  • Security Champions in DevSecOps: Responsibilities and Best Practices
  • The DevSecOps Handbook for Shift-Left Security
  • Top DevSecOps Principles for Effective Secure Software Delivery
  • Guide to DevSecOps Maturity Levels for Platform and Security Teams
  • Canada PR CRS Calculator: Express Entry Points System Explained
  • Austria PR Points Calculator: Ultimate Guide to Navigating the Red-White-Red Card System
  • The Essential Guide to Enterprise DevSecOps Implementation
  • How to Set Up Claude Code Agent on a Local Windows Laptop and Use claude Command from Anywhere
  • DevOps and DevSecOps Explained: Bridging the Gap Between Speed and Security
  • Comprehensive Manual on DevOps Methodologies and Cloud Native Engineering
  • The Master Guide to Immigration Points: Calculating Your Path to Canada, Australia, and Beyond
  • How to Skip the Activation Email and Password Reset After Google Login in Keycloak Auto-Link Existing Users in First Broker Login
  • Free SSL Certificate Generation Tutorial for Any Website Using Certbot and Apache
  • The Ultimate Guide to Certified FinOps Professional: Skills, Levels, and Career Impact
  • Certified FinOps Manager: Essential Skills for Modern Cloud Operations
  • How to Use Claude AI for Programming: Complete Guide for Developers to Boost Productivity
  • The Definitive Guide to Certified FinOps Engineer: Master Cloud Value Engineering
  • A Comprehensive Guide to the Certified FinOps Architect Certification and Training
  • Linux Server Diagnostic Commands: Complete Guide for Performance, Network & System Troubleshooting
  • The Ultimate Guide to CDOM – Certified DataOps Manager Certification

Recent Comments

  1. emmy day on SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘provider’ in ‘field list’
  2. digital banking on Complete Tutorial: Setting Up Laravel Telescope Correctly (Windows + XAMPP + Custom Domain)
  3. SAHIL DHINGRA on How to Uninstall Xampp from your machine when it is not visible in Control panel programs & Feature ?
  4. Abhishek on MySQL: List of Comprehensive List of approach to secure MySQL servers.
  5. Kristina on Best practices to followed in .httacess to avoid DDOS attack?

Archives

  • June 2026
  • May 2026
  • April 2026
  • 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
  • Mautic
  • Medical Tourism
  • MlOps
  • MobaXterm
  • Mobile Device Management
  • Multi-Factor Authentication
  • MySql
  • Network Traffic Analysis tools
  • Paytm
  • Penetration Testing
  • php
  • PHPMyAdmin
  • Pinterest Api
  • postify
  • 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
  • SSL
  • 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