Val Okafor
Val Okafor

Reputation: 3437

Where Exactly Should I Place .GitIgnore File in Android Studio Project

I have placed the following .gitignore file at the root of my Android Studio Project

# Built application files
*.apk
*.ap_

# Files for the Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Windows clutter
Thumbs.db

# Intellij IDEA (see https://intellij-support.jetbrains.com/entries/23393067)
.idea/workspace.xml
.idea/tasks.xml
.idea/datasources.xml
.idea/dataSources.ids

However the following .gradle contents keeps getting added to the source control.

 modified:   .gradle/1.12/taskArtifacts/cache.properties.lock
 modified:   .gradle/1.12/taskArtifacts/fileHashes.bin
 modified:   .gradle/1.12/taskArtifacts/fileSnapshots.bin
 modified:   .gradle/1.12/taskArtifacts/taskArtifacts.bin

.gradle and its sub folders are marked to be ignored in the .gitignore however these keeps getting updated each time I so much as run the app in an Emulator. I do not remember dealing with these in Eclipse projects.

Are these .gradle files I showed above necessary to be version controlled, if not how can I modify my .gitignore to actually ignore them?

Upvotes: 5

Views: 3916

Answers (2)

bastami82
bastami82

Reputation: 6153

If you getting .gradle/X.XX/... poping up in your local changes tab then use

git rm -rf .gradle/ (NOTE THE DOT)

otherwise you will remove gradle folder which includes your wrapper folder.

Upvotes: 2

Ryan Groten
Ryan Groten

Reputation: 208

If the .gradle files are already in the git repository you need to clean them up first using git rm -rf gradle/. Don't forget to commit your changes after using git rm.

Upvotes: 2

Related Questions