What files should be in my .gitignore
for an Android Studio project?
I've seen several examples that all include .iml
but IntelliJ docs say that .iml
must be included in your source control.
What files should be in my .gitignore
for an Android Studio project?
I've seen several examples that all include .iml
but IntelliJ docs say that .iml
must be included in your source control.
I merge Github .gitignore files
Please read: JetBrains Support: How to manage projects under Version Control Systems
This official documentation from JetBrains Support says the following should be included:
It also gives other recommendations of things to be careful about.
For Android Studio 3.0 projects use the following:
.gitignore
Gradle project folder
The only thing that should be in your (Gradle) project folder after repository cloning is this structure (at least for the use cases I encountered so far):
Basically any file that is automatically regenerated.
A good test is to clone your repo and see if Android Studio is able to interpret and run your project immediately (generating what is missing).
If not, find what is missing, and make sure it isn't ignored, but added to the repo.
That being said, you can take example on existing
.gitignore
files, like the Android one.Depends on how your project format is maintained:
You have two options:
.idea
folder which contains the project specific files).iws
and.ipr
)Ref: http://www.jetbrains.com/idea/webhelp/project.html
Files committed to version control depends on the above:
workspace.xml
andtasks.xml
.ipr
file and all the.iml
module files, exclude the.iws
file as it stores user specific settings.Ref: https://intellij-support.jetbrains.com/entries/23393067
In the case of Android Studio, the only files that are required to be saved in version control are the files required to build the application from the command line using gradle. So you can ignore:
However, if you save any IDE settings, such as custom code style settings, they get saved in the .idea folder. If you want those changes in version control, then you'd save the IDEA files as well (*.iml and .idea).