Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 301
Val Okafor Avatar asked Sep 29 '22 14:09

Val Okafor


1 Answers

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.

like image 75
Ryan Groten Avatar answered Oct 02 '22 15:10

Ryan Groten