What files should be in my .gitignore
for an Android Studio project?
I\'ve seen several examples that all include .iml
but IntelliJ docs sa
I disagree with all of these answers. The following configuration is working great for our organization's app.
I ignore:
/build
/.idea
(with possible exceptions, see comments in dalewking's answer)*.iml
local.properties
I think almost everyone agrees about /build
.
I got sick of constantly seeing messages about the various library.xml
files that Gradle creates or deletes in /.idea
. The build.gradle
will run on the developers's local when they first check out the project, so why do those XML files need to be versioned? Android Studio will also generate the rest of /.idea
when a developer creates a project using Check out from Version Control
, so why does anything in that folder need to be versioned?
If the *.iml
is versioned a new user will have to name the project exactly the same as it was when committed. Since this is also a generated file, why version it in the first place?
The local.properties
files points to an absolute path on the file system for the SDK, so it definitely shouldn't be versioned.
Edit 1: Added .gradle
to ignore the gradle caching stuff that should not be versioned (thanks Vasily Makarov).
Edit 2: Added .DS_Store
now that I am using Mac. This folder is Mac specific and should not be versioned.
Additional note: You probably also want to add a directory to put your signing keys in when building a release version.
For copy/paste convenience:
.gradle
/build
/.idea
*.iml
local.properties
.DS_Store