Usman
Usman

Reputation: 2391

Can I delete these build folders when I am not running Android Studio?

I am backing up android studio projects in google drive and I found that the build folders contain thousands of files, so google drive ends up tired.

My practice is that I run the 'clean project' command in Android Studio before exiting so that the unnecessary files are cleaned and only the important files remain to be backed up. But still sometimes the build folder remains there with many files.

My question is that if I delete these two build folders manually (see screenshot), will my project rebuild again on next startup, or will it mess up my project?

Two build folders

Upvotes: 34

Views: 43240

Answers (6)

Erfan
Erfan

Reputation: 156

Yes, you can delete the Build folder.

If you are running Windows and you are not able to delete the folder, make sure you are the owner of the folder. Go to folder properties/security and check if your name is listed as the owner.

Also, make sure you mark the "full control". This will surely delete the folder. Next time when you run Android Studio, the necessary build stuff will be created by Android Studio.

Upvotes: 1

Igmer Rodriguez
Igmer Rodriguez

Reputation: 172

The best practice is to use a version control system like git, it generates a .gitignore file where the unnecessary files are mentioned. (this files are created then by youy IDE) example of gitignore:

.iml

.gradle

/local.properties

/.idea/workspace.xml

 /.idea/libraries

.DS_Store

/ build

/ captures

.externalNativeBuild

*.idea

.idea / modules.xml

Upvotes: 2

Reza
Reza

Reputation: 4743

If you are using a unix based OS you might be able to run following command using terminal:

 find . -name build -exec rm -rf {} \;

which causes to delete all build folders inside a specific folder.

Upvotes: 20

Yashaswi N P
Yashaswi N P

Reputation: 933

Removing the build file doesn't mess up application but yes it gets created again and it rebuilds the application. If you read the below link they have clearly mentioned why build file is created and required.

https://developer.android.com/studio/build/index.html

Hope this helps.

Upvotes: 5

Abdul Waheed
Abdul Waheed

Reputation: 4678

You can do one thing as I do. Just keep app folder and delete remaining folders. When you need to use that project again. Create new project and replace that app folder with your and done.

Upvotes: 4

CommonsWare
CommonsWare

Reputation: 1006539

will my project rebuild again on next startup

Yes. For situations where backups are expensive in terms of space, time, or money, follow the rules for what goes into version control (e.g., git), and back up only those things.

Upvotes: 24

Related Questions