Typical .gitignore file for an Android app

Solution 1:

You can mix Android.gitignore:

# built application files
*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/
gen/

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

with Eclipse.gitignore:

*.pydevproject
.project
.metadata
bin/**
tmp/**
tmp/**/*
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# CDT-specific
.cproject

# PDT-specific
.buildpath

Solution 2:

In addition to what the others have suggested, I'd like to add the proguard folder, in case you are using it. You can either ignore the whole folder or just dump.txt, seeds.txt and usage.txt. Basically, it's a good idea to keep mapping.txt versioned, so that you can debug obfuscated stack traces from your users. More details here.

Solution 3:

This is my standard Android .gitignore and .hgignore file. It usually works pretty well.

bin
gen
target
.settings
.classpath
.project
*.keystore
*.swp
*.orig
*.log
*.properties
seed.txt
map.txt

It has eclipse, vim .swp files, mavens target folder and files for proguard mapping included.

Update: I have put my .gitignore for Android development online.

Solution 4:

Well I know that the github/gitignore repository on GitHub has an android .gitignore file. This might be what you want as it should be very general for android development.

The actual content of the mentioned file:

# built application files
*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/
gen/

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