How To Clean Project In Android Studio
Put your Android Studio on a nutrition
How to make a deep clean of your Android Studio & Gradle junk files to set up upwardly the mess.
Practice you know that when y'all're updating your Android Studio, Gradle or even dependencies, some old files are still present on your auto and can waste some disk free space?
On our laptops, disk space is limited and clearing those files will make you gain a lot of gratuitous space available. Having too many junk files may also slow down your machine and your builds!
In my case, I was also having strange build errors or gradle sync failures when it was working on my colleague's car.
It was time to do some deep cleaning and put our Android Studio on a nutrition by following some simple steps.
Clear your project directory
- Obviously, endeavour to clean your project from android studio : "Build -> Make clean Project". This volition clear your build folders.
- Clear the enshroud of Android Studio using "File -> Invalidate Caches / Restart" cull "Invalidate and restart pick" and close Android Studio.
- Remove your .gradle directory from the root of your projection. It contains some Gradle cache files.
- Delete also the .thought directory (brand a backup before). It contains some projection configuration files.
- Restart Android Studio.
Big project directories can weight around 500MB to 1GB.
Gradle cleaning
Now let'south take a look at Gradle files. If none of the to a higher place suggestions ready your problem, try these:
Go to your ~/.gradle directory. This is the Gradle abode directory, containing caches, daemons and wrappers files. This is a really huge one, mine was ~15GB.
Inside those directories, you lot'll have sub-directories for each version of Gradle you've been using. So, the more projects you have with different Gradle versions, the more sub-directories yous will have.
You can delete those iii directories:
- caches: Gradle enshroud files.
- daemon: essentially logs files of Gradle daemons.
- wrapper: different distributions of Gradle downloaded on you machine.
Android Studio cleanup
- Go to your Android habitation, usually ~/.android and clear build-cache and cache directories. There are few MB to free here (~100MB for me)
- In the ~/Library/{Preferences, Caches, Logs, Application Support} directories, you will find the Android Studio preferences files, settings and plugins. You tin clear the directories of previous version of Android Studio (>1GB per version of Equally). Starting with version three.3, Android Studio will propose y'all to remove them later on an update.
- Android Studio 3.half dozen (still in preview) added an option to clear temporary files, which tin gratis upwards some precious GB.
Android SDK cleaning
On Android Studio, check the SDK Manager and remove the following items:
- Onetime SDKs you don't use anymore. I guess you lot'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 xx" items as it will let you to check the source code of the SDK from a previous version of Android & help y'all debugging.
- On the SDK Tools tab, click on "Bear witness Packages Details" and uncheck the erstwhile build-tools or NDK versions.
- Delete unused emulators using the AVD.
You can gain easily 10GB with these steps.
Extra cleaning
At that place is some extra stuff you lot can clean too:
- Your download directory: you may have downloaded a lot of GIFs, video, Android Studio binaries that you lot can remove.
- Clear your local git branches that have been merged (don't remove the ones that yous all the same need!).
- Delete all those photoshopped pictures of your colleagues ( ͡° ͜ʖ ͡°).
- Articulate your recycle bin.
That's information technology ! You've gained some precious disk space on your auto and maybe fixed some weird issues with your Android Studio.
I don't recommend to do a total make clean everyday, you'll waste time and your build time will be quite longer so you'll be less productive. Take it just as a "spring cleaning" ritual.
I hope it helped you, and don't forget to follow the Marie Kondo mantra and only keep things that spark joy.
Source: https://medium.com/back-market-engineering/put-your-android-studio-on-a-diet-fa4d364acb05#:~:text=Clear%20your%20project%20directory,option%E2%80%9D%20and%20close%20Android%20Studio.
Posted by: mcmichaelthingaing.blogspot.com

0 Response to "How To Clean Project In Android Studio"
Post a Comment