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.
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.I merge Github .gitignore files
Please read: JetBrains Support: How to manage projects under Version Control Systems
I had problems with ignoring build files, but this seems to work :-)
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):
It's the best way to generate
.gitignore
via hereBuilding on my normal Android .gitignore, and after reading through documentation on the Intellij IDEA website and reading posts on StackOverflow, I have constructed the following file:
Also note that as pointed out, the built native files section is primarily useful when you are building your own native code with the Android NDK. If, on the other hand, you are using a third party library that includes these files, you may wish to remove these lines (*.o and *.so) from your .gitignore.