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

后端 未结 30 3711
星月不相逢
星月不相逢 2020-11-22 04:23

What files should be in my .gitignore for an Android Studio project?

I\'ve seen several examples that all include .iml but IntelliJ docs sa

30条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-22 04:55

    Updated 7/2015:

    Here is the definitive source from JetBrains


    Directory based project format (.idea directory)

    This format is used by all the recent IDE versions by default. Here is what you need to share:

    • All the files under .idea directory in the project root except the workspace.xml and tasks.xml files which store user specific settings
    • All the .iml module files that can be located in different module directories (applies to IntelliJ IDEA)

    Be careful about sharing the following:

    • Android artifacts that produce a signed build (will contain keystore passwords)
    • In IDEA 13 and earlier dataSources.ids, datasources.xml can contain database passwords. IDEA 14 solves this problem.

    You may consider not to share the following:

    • gradle.xml file, see this discussion
    • user dictionaries folder (to avoid conflicts if other developer has the same name)
    • XML files under .idea/libraries in case they are generated from Gradle project

    Legacy project format (.ipr/.iml/.iws files)

    • Share the project .ipr file and all the .iml module files, don't share the .iws file as it stores user specific settings

    While these instructions are for IntelliJ IDEA, they hold true 100% for Android Studio.


    Here is a .gitignore snippet that incorporates all of the above rules:

    # Android Studio / IntelliJ IDEA 
    *.iws
    .idea/libraries
    .idea/tasks.xml
    .idea/vcs.xml
    .idea/workspace.xml
    

提交回复
热议问题