Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A .gitignore for use in Android Studio
# Built application files
/*/build/
# Crashlytics configuations
com_crashlytics_export_strings.xml
# Local configuration file (sdk path, etc)
local.properties
# Gradle generated files
.gradle/
# Signing files
.signing/
# User-specific configurations
.idea/libraries/
.idea/workspace.xml
.idea/tasks.xml
.idea/.name
.idea/compiler.xml
.idea/copyright/profiles_settings.xml
.idea/encodings.xml
.idea/misc.xml
.idea/modules.xml
.idea/scopes/scope_settings.xml
.idea/vcs.xml
*.iml
# OS-specific files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
@NenadJ

This comment has been minimized.

Copy link

commented Mar 13, 2015

Thank you !

@gjobin

This comment has been minimized.

Copy link

commented May 7, 2015

Thanks a LOT !

I think it is important to note that one must "Sync Project with Gradle Files" after a fresh checkout.

@rondelrosario

This comment has been minimized.

Copy link

commented May 11, 2015

I know this sounds stupid but where do I put/find my .gitignore file in Android Studio? :(

@EyalDagiAvdor

This comment has been minimized.

Copy link

commented May 12, 2015

@rondelrosario - In the root directory of your project, where you have .gradle, .idea, app, build etc.

@StefanUA

This comment has been minimized.

Copy link

commented May 15, 2015

rondelrosario good question. I didn't know that too

@primax79

This comment has been minimized.

Copy link

commented Aug 3, 2015

I woldn't remove .idea/vcs.xml
it uses relatives paths, and it's good to keep versioned

@androidvsourz

This comment has been minimized.

Copy link

commented Sep 22, 2015

Think me as a stupid but i spend half of a day knowing where to put git ignore file :p.
Thanks to the discussion.

@SamIAmHarris

This comment has been minimized.

Copy link

commented Dec 7, 2015

Why do you exclude more .idea files than the default android studio .gitignore file? Been trying to figure out which .idea files to keep and which to ignore.

Thanks a lot

@skyseraph

This comment has been minimized.

Copy link

commented Jan 12, 2016

good~

@matrixcloud

This comment has been minimized.

Copy link

commented Jan 17, 2016

Thanks

@getsadzeg

This comment has been minimized.

Copy link

commented Jan 23, 2016

👍

@MythicAngel

This comment has been minimized.

Copy link

commented Jan 31, 2016

Gradle .jar files should be included into Git (although only once is enough). Ref: here

@BoxResin

This comment has been minimized.

Copy link

commented Mar 19, 2016

Thank you!

@ildar2

This comment has been minimized.

Copy link

commented Apr 5, 2016

Help please: I have configured my .gitignore file, but my 'app.iml' and 'gradle.properties' are still staged to commit. How can I delete them from commit?

@makunomark

This comment has been minimized.

Copy link

commented Apr 18, 2016

Helpful!

@ghost

This comment has been minimized.

Copy link

commented Apr 25, 2016

Thank you!

@mmanzhos

This comment has been minimized.

Copy link

commented Apr 28, 2016

@idlar2 take a look
git rm --cached
use --cached for deleting from git, but preserving in file system.

@fernandoferreiratbe

This comment has been minimized.

Copy link

commented Jun 17, 2016

Thank you.

@Yousha

This comment has been minimized.

Copy link

commented Aug 15, 2016

I think you shouldn't ignore .idea/compiler.xml

@bryce13950

This comment has been minimized.

Copy link

commented Aug 20, 2016

The entire .idea directory should be ignored

@luckio41

This comment has been minimized.

Copy link

commented Aug 29, 2016

Nice!!

@jason-hwang

This comment has been minimized.

Copy link

commented Nov 1, 2016

Awesome :D

@mhd-adeeb-masoud

This comment has been minimized.

Copy link

commented Nov 4, 2016

Thanks! always useful

@raghukraman

This comment has been minimized.

Copy link

commented Nov 24, 2016

Thanks. very useful. if any directory is already staged, then you can use the following command to remove all the staged files under that directory.

git rm --cached -rf .idea

@rooksoto

This comment has been minimized.

Copy link

commented Apr 17, 2017

Very helpful, thanks!

@parzibyte

This comment has been minimized.

Copy link

commented Jun 21, 2017

Thank you! :)

@alex-chaliy

This comment has been minimized.

Copy link

commented Jun 23, 2017

Клёво, клёво, клёво

@lewisevans

This comment has been minimized.

Copy link

commented Oct 17, 2017

You may want to add /captures and .externalNativeBuild also

@arkayapps

This comment has been minimized.

Copy link

commented Nov 12, 2017

Thanks.

@ABCsHub

This comment has been minimized.

Copy link

commented Dec 30, 2017

i are making a Operating System with linux. i will use these gitignore :) 👌

Gabriel Pereira

@lddatacom

This comment has been minimized.

Copy link

commented Jan 7, 2018

Hi,

Not sure if there is something wrong but when I applied this gitignore file, all xml files in the project is ignored as well. Anyone got same issue or know how to solve it?

Thanks.

@karimkod

This comment has been minimized.

Copy link

commented Mar 2, 2018

Thank you :D

@fari-99

This comment has been minimized.

Copy link

commented Apr 10, 2018

thanks you so much

@salouri

This comment has been minimized.

Copy link

commented Aug 8, 2018

thank you. I also think /*/build/ should be **/build/

@jackycaojiaqi

This comment has been minimized.

Copy link

commented Aug 25, 2018

thanks @salouri you save my time

@LuckyTeng

This comment has been minimized.

Copy link

commented Nov 10, 2018

thanks, this is really saving my time:)

@MarcinKulwicki

This comment has been minimized.

Copy link

commented Dec 4, 2018

.gitignore you must create in root folder.
Change view from Android -> Project and in MyAppFolder create .gitignore.

@gauravsngarg

This comment has been minimized.

Copy link

commented Jun 24, 2019

Thanks for this post. it helped.

@vjayrajput

This comment has been minimized.

Copy link

commented Jul 5, 2019

Hi,

Not sure if there is something wrong but when I applied this gitignore file, all xml files in the project is ignored as well. Anyone got same issue or know how to solve it?

Thanks.

I am facing the same problem nowadays. Do you find a solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.