Reputation: 2391
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?
Upvotes: 34
Views: 43240
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
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
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
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
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
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