Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Clean project in Android Studio really doing?

I have used clean project a few times after breaking my tutorial app. I did this by doing a refactor or some other fancy command on a variable. I don't actually know what android studio is doing in the background and I am wondering if anyone can give a good detailed answer in simple English. :)

Thank you in advance,

like image 362
Tyrant911 Avatar asked Jan 03 '17 08:01

Tyrant911


People also ask

What happens if project is clean Android Studio?

Obviously, try to clean your project from android studio : “Build -> Clean Project”. This will clear your build folders. Clear the cache of Android Studio using “File -> Invalidate Caches / Restart” choose “Invalidate and restart option” and close Android Studio.

What does project Clean do in Eclipse?

It removes whatever already-compiled files are in your project so that you can do a complete fresh rebuild.

What does rebuild project do?

Rebuild removes the build folder's contents. And builds some binaries; not including the APK!

Can I delete a project in Android Studio?

Use Windows File Explorer to navigate to the Android Studio project directory (normally in "x:\Users\YourName\AndroidStudioProjects") Select the project to delete. Press Delete (NOT Backspace!)


3 Answers

Simple answer it Deletes the build directory

It removes whatever already-compiled files are in your project meaning it removes the .class files and recompiles the project again.

Source is here : https://www.jetbrains.com/help/idea/2016.3/cleaning-system-cache.html?search=clean

If you want to have some fun by cleaning yourself

Open your project path using cmd (go to project path and type cmd and hit enter like below)

enter image description here

Then use command gradlew clean and hit enter and see what happens when it cleans

enter image description here

For other tasks and meet your project's Mr.Gradle use command gradlew help

enter image description here

like image 195
Charuක Avatar answered Oct 12 '22 07:10

Charuක


Clean action, basically invoking ./gradle clean task in your application directory, which is removing all generated files, removes build folders. So basically next time you will run/build all the artifacts will be builded from the scratch and will not be reused.

More information you can find on a official gradle site

Information about android plugin

DSL reference for Android plugin

like image 5
Lebedevsd Avatar answered Oct 12 '22 08:10

Lebedevsd


Cleaning the project removes all build artifacts (ex: deleting the app/build folder)

like image 1
Sammy Shwairy Avatar answered Oct 12 '22 08:10

Sammy Shwairy