Gradle creates a folder called .gradle
. Should I track it with my version control (i.e. git)?
More importantly, why / why not?
Inside the project you can find the . gradle folder. Inside you can find all settings and other files used by gradle to build the project. You can delete these files without problems.
gradle directory is to try and keep the build process all contained in one location (e.g. if the app project files are on another drive). On some Windows computers the C: drive may be low on space. This means programs and files may need to be installed and run from another drive.
So the conclusion: Yes, you can delete the, if you do not use the apps associated with them.
gradle folder location for Android studio, you must: Define the GRADLE_USER_HOME environment variable to point to C:\WorkFolder\ . gradle. You can read more in the Configure the IDE docs.
Should I track the .gradle directory?
No. It can safely be ignored.
Why should I ignore it?
It's purely for caching information, you don't want it in your repo because:
It's basically a temp directory that Gradle is dropping in the middle of your source code (why Gradle thinks that's an appropriate thing to do is a different question).
You can tell the "cache directory" nature of the directory by the name of the switch that lets you change where it goes: "--project-cache-dir".
Though I hate having binary files in my source tree, I usually just end up adding the directory to my ignore file because somewhere along the line I'll forget to use the switch from some command line or from my IDE or something and then end up having to deal with the directory anyway.
How do I ignore it?
Git users can add a line with just .gradle
to the .gitgnore file and Git will ignore all files in any directory with that name.
Mercurial users will want to look up the .hgignore file.
For other version control systems, refer to the documentation - they all have a feature to support this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With