Best Practices for adding .gitignore file in Android projects


This tutorials talks about which files in android project are commited and which files are not ignored to git repository.

gitignore is a text file which contains list of files or patterns are excluded while commiting an android project.

Following are list of files and patters for gitignore files

java files are compiled to class files so class files are not required to commit to repository

# Java class files
*.class

lot of temparory files are generated

# generated files
bin/
gen/

Gradle local files are not required and build folder contains build output of an project

# Ignore gradle files
.gradle/
build/

Configuration files like .iws, .ipr , .iml, local.properties can be excluded

# configuration
.iws
.ipr
.iml 
local.properties

Build generated package files

The following generate package files can be added

# built generated package files
*.apk
*.ap_

Dalmik VM files

# the Dalvik VM files
*.dex

log files

*.log

keystore files

*.jks

Android projects opens in either Android studio as well as Intelli IDEA.

These IDE related files can be ignored

# Android Studio / IntelliJ IDEA 
*.iws
.idea/libraries
.idea/tasks.xml
.idea/vcs.xml
.idea/workspace.xml
/out/

Operation System specific files

# OS temparory files
.DS_Store
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
THE BEST NEWSLETTER ANYWHERE
Join 6,000 subscribers and get a daily digest of full stack tutorials delivered to your inbox directly.No spam ever. Unsubscribe any time.

Similar Posts
Subscribe
You'll get a notification every time a post gets published here.