respectTheCode respectTheCode - 1 year ago 105
Git Question

What should be in my .gitignore for an Android Studio project?

What files should be in my .gitignore for an Android Studio project?

I have seen several examples that all include .iml but IntelliJ docs say that .iml must be included in your source control.

Answer Source

Update: Since Android Studio 1.0 (updated on 1.5), new projects are created with this gitignore file:


Verify if it suits your needs and if not, read on.


A late answer but none of the answers here and here was right on the money for us...

So, here's our gitignore file:

#built application files

# files for the dex VM

# Java class files

# generated files

# Local configuration file (sdk path, etc)

# Windows thumbnail db

# OSX files

# Eclipse project files

# Android Studio
#.idea/workspace.xml - remove # and delete .idea if it better suit your needs.


Optional - for older project format, add this section to your gitignore file:


This file should be located in the project's root folder and not inside the project's module folder.

Edit Notes:

  1. Since version 0.3+ it seems you can commit and push *.iml and build.gradle files. If your project is based on Gradle: in the new open/import dialog, you should check the "use auto import" checkbox and mark the "use default gradle wrapper (recommended)" radio button. All paths are now relative as @George suggested.

  2. Updated answer according to @128KB attached source and @Skela suggestions

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download