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

后端 未结 30 3362
星月不相逢
星月不相逢 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

    Android Studio 4.1.1

    If you create a Gradle project using Android Studio the .gitignore file will contain the following:

    .gitignore

    *.iml
    .gradle
    /local.properties
    /.idea/caches
    /.idea/libraries
    /.idea/modules.xml
    /.idea/workspace.xml
    /.idea/navEditor.xml
    /.idea/assetWizardSettings.xml
    .DS_Store
    /build
    /captures
    .externalNativeBuild
    .cxx
    local.properties
    

    I would recommend ignoring the complete ".idea" directory because it contains user-specific configurations, nothing important for the build process.

    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):

    app/
    .git/
    gradle/
    build.gradle
    .gitignore
    gradle.properties
    gradlew
    gradlew.bat
    settings.gradle
    

    Note: It is recommended to check-in the gradle wrapper scripts (gradlew, gradlew.bat) as described here.

    To make the Wrapper files available to other developers and execution environments you’ll need to check them into version control.

提交回复
热议问题