2015-11-28 52 views
15

我最近創建了一個Android項目,但這是我第一次與Android Studio合作,我將該項目放置在Git文件夾中,以便能夠通過Git遠程與其他開發人員合作,並且我發現默認的.gitignore文件包含以下內容:理想的Android Studio gitignore文件

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

我只是想知道這是理想的gitignore文件,以便能夠一起工作遠程?或者我必須編輯或從中刪除一些文件?

+1

的可能的複製([應該是我的.gitignore了一個Android Studio項目是什麼?] http://stackoverflow.com/questions/16736856/what-should-be-in-my-gitignore-for-an-android-studio-project) – RogueBaneling

回答

39

對我來說,理想的gitignore文件是:

### Android ### 
# Built application files 
*.apk 
*.ap_ 

# Files for the Dalvik VM 
*.dex 

# Java class files 
*.class 

# Generated files 
bin/ 
gen/ 

# Gradle files 
.gradle/ 
build/ 

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

# Proguard folder generated by Eclipse 
proguard/ 

# Log Files 
*.log 

# Android Studio Navigation editor temp files 
.navigation/ 

### Android Patch ### 
gen-external-apklibs 


### Java ### 
*.class 

# Mobile Tools for Java (J2ME) 
.mtj.tmp/ 

# Package Files # 
*.jar 
*.war 
*.ear 

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 
hs_err_pid* 


### Intellij ### 
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio 

*.iml 

## Directory-based project format: 
.idea/ 
# if you remove the above rule, at least ignore the following: 

# User-specific stuff: 
# .idea/workspace.xml 
# .idea/tasks.xml 
# .idea/dictionaries 

# Sensitive or high-churn files: 
# .idea/dataSources.ids 
# .idea/dataSources.xml 
# .idea/sqlDataSources.xml 
# .idea/dynamic.xml 
# .idea/uiDesigner.xml 

# Gradle: 
# .idea/gradle.xml 
# .idea/libraries 

# Mongo Explorer plugin: 
# .idea/mongoSettings.xml 

## File-based project format: 
*.ipr 
*.iws 

## Plugin-specific files: 

# IntelliJ 
/out/ 
/captures 

# mpeltonen/sbt-idea plugin 
.idea_modules/ 

# JIRA plugin 
atlassian-ide-plugin.xml 

# Crashlytics plugin (for Android Studio and IntelliJ) 
com_crashlytics_export_strings.xml 
crashlytics.properties 
crashlytics-build.properties 

您也可以使用真棒服務:https://www.gitignore.io/

+0

'* .class'條目定義不止一次:) –