How To Clean Junk Files On Android
Put your Android Studio on a diet
How to make a deep clean of your Android Studio & Gradle junk files to prepare upwardly the mess.
Do you know that when you're updating your Android Studio, Gradle or even dependencies, some old files are still present on your machine and can waste some disk free space?
On our laptops, disk infinite is limited and clearing those files will make y'all gain a lot of free space available. Having too many junk files may also boring down your motorcar and your builds!
In my case, I was besides having strange build errors or gradle sync failures when it was working on my colleague's machine.
It was time to exercise some deep cleaning and put our Android Studio on a nutrition past post-obit some elementary steps.
Clear your projection directory
- Obviously, try to clean your projection from android studio : "Build -> Clean Project". This will clear your build folders.
- Clear the cache of Android Studio using "File -> Invalidate Caches / Restart" cull "Invalidate and restart option" and close Android Studio.
- Remove your .gradle directory from the root of your project. It contains some Gradle enshroud files.
- Delete also the .idea directory (brand a backup before). It contains some project configuration files.
- Restart Android Studio.
Big project directories can weight around 500MB to 1GB.
Gradle cleaning
Now let'southward take a wait at Gradle files. If none of the above suggestions fix your problem, try these:
Go to your ~/.gradle directory. This is the Gradle home directory, containing caches, daemons and wrappers files. This is a really huge one, mine was ~15GB.
Inside those directories, you'll have sub-directories for each version of Gradle yous've been using. Then, the more than projects yous take with different Gradle versions, the more sub-directories you will accept.
You tin delete those three directories:
- caches: Gradle cache files.
- daemon: essentially logs files of Gradle daemons.
- wrapper: different distributions of Gradle downloaded on you motorcar.
Android Studio cleanup
- Become to your Android home, normally ~/.android and clear build-enshroud and cache directories. There are few MB to free here (~100MB for me)
- In the ~/Library/{Preferences, Caches, Logs, Awarding Support} directories, yous will find the Android Studio preferences files, settings and plugins. You can clear the directories of previous version of Android Studio (>1GB per version of AS). Starting with version iii.three, Android Studio volition propose you to remove them after an update.
- Android Studio 3.six (notwithstanding in preview) added an choice to articulate temporary files, which can gratuitous upwards some precious GB.
Android SDK cleaning
On Android Studio, bank check the SDK Manager and remove the following items:
- Old SDKs you don't apply anymore. I judge y'all'll not miss the Android 3.0 SDK files.
- Remove the emulators you don't use as they're quite heavy (some GB).
- I recommend to keep "Sources for Android twenty" items as it will permit you lot to check the source code of the SDK from a previous version of Android & help you debugging.
- On the SDK Tools tab, click on "Prove Packages Details" and uncheck the one-time build-tools or NDK versions.
- Delete unused emulators using the AVD.
You tin proceeds hands 10GB with these steps.
Extra cleaning
There is some extra stuff you tin clean too:
- Your download directory: you may accept downloaded a lot of GIFs, video, Android Studio binaries that you can remove.
- Clear your local git branches that have been merged (don't remove the ones that you nonetheless need!).
- Delete all those photoshopped pictures of your colleagues ( ͡° ͜ʖ ͡°).
- Clear your recycle bin.
That'southward information technology ! Yous've gained some precious disk space on your machine and possibly stock-still some weird problems with your Android Studio.
I don't recommend to do a full clean everyday, you'll waste fourth dimension and your build time volition be quite longer so you lot'll exist less productive. Take it only equally a "spring cleaning" ritual.
I promise it helped y'all, and don't forget to follow the Marie Kondo mantra and only continue things that spark joy.
Source: https://medium.com/back-market-engineering/put-your-android-studio-on-a-diet-fa4d364acb05
Posted by: rosadoanxich.blogspot.com

0 Response to "How To Clean Junk Files On Android"
Post a Comment