37

I am using Android Studio 0.4.6 and Gradle 1.10. I want to commit into git the necessary files and folders, so that anyone cloning the repository can start working with the project and will not have any issues of missing files/settings because of not commited file. Could someone point what is needed to be into VCS and what is optional.

From question: "gradle directory in an Android Studio project" I see that the gradle/ folder is good to have it, but what about .idea/, .gradle/, gradlew.bat etc... I see inside local.properties that it should not be commited, but what about everything else?

Here is my .gitignore that works perfect for me now:

/app/build
.idea/workspace.xml
.idea/tasks.xml
.gradle
local.properties
Community
  • 1
  • 1
dragi
  • 3,385
  • 5
  • 22
  • 40
  • @trooper That question was not considering Gradle, at the time I asked mine. But now I see that the answer has been updated for gradle-based projects as well. – dragi Feb 02 '15 at 12:38
  • Ah, that makes sense helleye. BTW, I found both questions to be very helpful (+1). – trooper Feb 02 '15 at 18:04

1 Answers1

16

You can take a look at What should be in my .gitignore for an Android Studio project?

If you use the .gitignore file from that questions you shouldn't have any problems.

I think that if you create a new project inside a git directory Android Studio will automatically create the necessary .gitignore files for your project.

EDIT: Actually it seems that my Android Studio always generates .gitignore files when I create a project.

Community
  • 1
  • 1
  • I have seen my Studio also generating the .gitignore files, but I don't know why it stopped doing it. Maybe it is something in 0.4.6 version. Btw I am always cloning a repository, which once contained a non-gradle project, but now it is migrated to Gradle. I will compile a .gitignore file myself, by using the answers on the link you proposed, and if it helps I will let you know :) – dragi Mar 06 '14 at 10:28
  • 12
    That .gitignore file is good advice -- don't check in .idea, don't check in .gradle, don't check in any .iml files, don't check in local.properties, do check in gradle, do check in gradlew, do check in gradlew.bat. – Scott Barta Mar 06 '14 at 17:27
  • 3
    "Don't check in .idea" is too broad of a suggestion. You might want to check in .idea/runConfigurations, .idea/encodings.xml and .idea/inspectionProfiles, to name a couple – Nilzor Dec 03 '15 at 12:08
  • For further information on VCS management of .idea see: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 – rodrigobartels Jun 23 '16 at 21:48