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

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

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.

Answers

  Update:   

Since Android Studio 2.2, new projects are created with this gitignore file:

*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild

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

  Previous:   

http://stackoverflow.com/questions/16640566/which-files-shouldnt-be-checked-in-into-version-control-in-android-studio http://stackoverflow.com/questions/16640566/which-files-shouldnt-be-checked-in-into-version-control-in-android-studio

So, here s our gitignore file:

#built application files
*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/
gen/

# Local configuration file (sdk path, etc)
local.properties

# Windows thumbnail db
Thumbs.db

# OSX files
.DS_Store

# Eclipse project files
.classpath
.project

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

#NDK
obj/

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

/*/out
/*/*/build
/*/*/production
*.iws
*.ipr
*~
*.swp

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

  Edit Notes:   
    • 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.
    https://github.com/google/iosched/blob/master/.gitignore https://github.com/google/iosched/blob/master/.gitignore

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/16736856/what-should-be-in-my-gitignore-for-an-android-studio-project

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils