You’ve probably noticed that Android Studio doesn’t have a “clean” menu option. But we know that, like any build environment, there are intermediate files created that we may want to occasionally remove.

It turns out the solution is the command line. Simply open a command line in your project’s root folder (Usually named something like MyAppProject) and run the following command

gradlew clean

You’ll see something like this…

gradlew_clean

Notice that you get a bit of an unexpected message, “BUILD SUCCESSFUL”. This simply indicates that it has gone through and successfully cleaned out the intermediate files. I’ve found that when dealing with larger projects its not uncommon to reduce the amount of disk space used by the project by 70% or more.

So a bit of an unexpected solution (especially for those who’ve been in a Windows environment for a long time) but an easy one.

To learn more about Android programming, checkout Jim’s Android courses on Pluralsight.

Jim's Android courses on Pluralsight

Jim’s latest book, “Creating Dynamic UI with Android Fragments” is now available on amazon.

Creating Dynamic UI with Fragments

Posted by hedgehogjim

30+ years as a professional software dev, 17+ years developing mobile solutions, Pluralsight Author, Founder JWHH, LLC

2 Comments

  1. i executed this command in the terminal in android studio, but it started downloading something:

    D:\documents\projects\android studio\intentApp>gradlew clean

    Downloading https://services.gradle.org/distributions/gradle-2.2.1-all.zip

    Reply

  2. […] fadeOutSpeed: 100, predelay: 400, position: "top right", relative: true, offset: [10, 10] });2)How to Clean an Android Studio Project jQuery("#footnote_plugin_tooltip_2").tooltip({ tip: "#footnote_plugin_tooltip_text_2", tipClass: […]

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s