Android 应用程序的典型.gitignore 文件

只需通过命令行(Mac 终端)将 Android 项目置于 git (豆茎)版本控制之下。下一步是设置排除条款。

对于那些已经走过这条路的人:

对于一个 android 项目,典型的. gitignore 文件应该是什么样子的?

Project set up in Eclipse

51354 次浏览

在我的项目根目录中有一个.gitignore 文件,它包含:

/bin/
/gen/

Well I know that the github/gitignore repository on GitHub has an 机器人,小丑 file. This might be what you want as it should be very general for android development.

上述文件的实际内容:

# 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

这是我的标准 Android .gitignore.hgignore文件。它通常工作得很好。

bin
gen
target
.settings
.classpath
.project
*.keystore
*.swp
*.orig
*.log
*.properties
seed.txt
map.txt

It has eclipse, vim .swp files, mavens target folder and files for proguard mapping included.

Update: I have put my . gitignore for Android development online.

你可以混合 机器人,别闹了:

# 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

Eclipse.gitignore合作:

*.pydevproject
.project
.metadata
bin/**
tmp/**
tmp/**/*
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath


# External tool builders
.externalToolBuilders/


# Locally stored "Eclipse launch configurations"
*.launch


# CDT-specific
.cproject


# PDT-specific
.buildpath

除了其他人的建议,我还想添加 proguard文件夹,以防您正在使用它。您可以忽略整个文件夹,也可以只忽略 dump.txtseeds.txtusage.txt。基本上,保持 mapping.txt版本是一个好主意,这样您就可以调试来自您的用户的模糊堆栈跟踪。更多细节 给你

此外,如果您使用 IDEA 的 IntelliJ,并且构建了 艺术品(您应该这样做) ,那么您可能需要添加:

out/

(这是构建工件的默认位置)。

如果你不想分享你的 IntelliJ 项目,忽略

.idea/

这是我在 Android 项目中使用的一个,它同时支持 ADT 和 Android Studio,所以如果你正在与一个团队一起工作,这是很好的。

# General Folders


# gradle/ comment this when using gradle wrapper.
build/
bin/
gen/
tmp/
# proguard/ comment if not using proguard.
.gradle/
.settings/
.idea/


# General Files


.project
.classpath
.DS_Store
local.properties
*.iml
# gradlew comment when using gradle wrapper
# gradlew.bat comment when using gradle wrapper
Thumbs.db




# files specific to current project
your_apk.apk

简单地说,Github可以为 Android 项目存储库生成 .gitignore

enter image description here

它的内容如下

# Built application files
*.apk
*.ap_


# Files for the ART/Dalvik VM
*.dex


# Java class files
*.class


# Generated files
bin/
gen/
out/


# 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 Studio captures folder
captures/


# IntelliJ
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
.idea/caches


# Keystore files
# Uncomment the following line if you do not want to check your keystore files in.
#*.jks


# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild


# Google Services (e.g. APIs or Firebase)
google-services.json


# Freeline
freeline.py
freeline/
freeline_project_description.json


# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md