If you're an Android developer, you've probably noticed that your available disk space keeps shrinking even when you don't install anything new.
Android Studio, Gradle, Windows updates, temporary files, and development tools continuously create cache files. Over weeks or months, these files can consume tens of gigabytes of storage.
In this guide, we'll look at some safe ways to recover disk space without affecting your projects.
Important: Before deleting anything, make sure Android Studio and the Android Emulator are completely closed.
1. Clean Android Studio Gradle Cache
Gradle downloads dependencies and stores build information locally to speed up future builds.
The cache grows every time you open different projects or update libraries.
Typical location:
C:\Users\<YourUserName>\.gradleThe following folders are generally safe to delete:
caches
daemon
notificationsWhat happens after deleting?
- Gradle automatically recreates them.
- Your first project build may take a little longer.
- No project files are lost.
2. Clean Windows Temporary Files
Windows stores thousands of temporary files that are often never removed.
Open Run (Win + R) and type:
%temp%Delete everything inside.
Some files may be in use and cannot be deleted. Simply choose Skip for those files.
This cleanup is completely safe and can recover several gigabytes over time.
3. Use Windows Disk Cleanup
Windows includes a built-in cleanup utility that removes unnecessary system files.
Steps
- Press Start
- Search for Disk Cleanup
- Right-click and select Run as Administrator
- Select your Windows drive (usually C:)
- Click Clean up system files
Recommended items to clean:
- Windows Update Cleanup
- Temporary Files
- Delivery Optimization Files
- DirectX Shader Cache
- Device Driver Packages
- Recycle Bin (after checking its contents)
Windows Update Cleanup alone can sometimes free several gigabytes after major updates.
4. Should You Disable the Hibernation File?
Windows creates a file named:
hiberfil.sysThis file is used for:
- Hibernate mode
- Fast Startup
Although disabling hibernation can free several gigabytes of storage, it also disables these Windows features.
Because many users rely on Fast Startup, and some laptops use hibernation for power management, it is generally not recommended unless you fully understand the consequences.
For most users, it's better to leave this feature enabled.
5. Should You Modify the Page File?
The Windows Page File (pagefile.sys) acts as virtual memory.
Even computers with large amounts of RAM still benefit from having a page file.
Reducing or disabling it may lead to:
- Out of memory errors
- Application crashes
- Reduced system stability
For that reason, most users should allow Windows to manage the page file automatically.
Bonus Tip: WSL Can Quietly Consume Huge Amounts of Disk Space
If you use Windows Subsystem for Linux (WSL), it may become one of the largest consumers of disk space.
WSL stores its Linux filesystem inside a virtual disk (VHDX). As packages are installed or Docker images accumulate, this virtual disk keeps growing.
The important thing to know is:
- The virtual disk automatically expands.
- It usually does not shrink automatically after files are deleted inside Linux.
If your WSL installation has grown very large, you may need to compact the virtual disk manually. This can recover many gigabytes of storage.
Final Thoughts
Regular maintenance helps keep your development machine fast and prevents unexpected "Low Disk Space" warnings.
A good monthly cleanup routine includes:
- Cleaning Gradle cache
- Removing Windows temporary files
- Running Disk Cleanup
- Reviewing WSL storage usage
These simple steps can often recover several gigabytes without affecting your projects.
Comments
Post a Comment