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

发布于 2024-12-21 01:15:57 字数 206 浏览 4 评论 0原文

只需通过命令行(mac 终端)将 Android 项目置于 git (beanstalk) 版本控制之下即可。下一步是设置排除项。

对于已经走这条路的人:

Android 项目的典型 .gitignore 文件应该是什么样子?

在 Eclipse 中设置项目

Just put an Android project under git (beanstalk) version control via the command line (mac terminal). Next step is to set up exclusions.

To those of you who have already been down this path:

What should a typical .gitignore file look like for an android project?

Project set up in Eclipse

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

手心的温暖 2024-12-28 01:15:57

您可以将 Android.gitignore:

# 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

You can mix Android.gitignore:

# 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

with 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
似梦非梦 2024-12-28 01:15:57

除了其他人的建议之外,我还想添加 proguard 文件夹,以防您使用它。您可以忽略整个文件夹,也可以仅忽略 dump.txtseeds.txtusage.txt。基本上,最好保持 mapping.txt 版本,以便您可以调试用户的模糊堆栈跟踪。更多详细信息请参见此处

In addition to what the others have suggested, I'd like to add the proguard folder, in case you are using it. You can either ignore the whole folder or just dump.txt, seeds.txt and usage.txt. Basically, it's a good idea to keep mapping.txt versioned, so that you can debug obfuscated stack traces from your users. More details here.

⒈起吃苦の倖褔 2024-12-28 01:15:57

这是我的标准 Android .gitignore.hgignore 文件。通常效果很好。

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

它包含 eclipse、vim .swp 文件、mavens 目标文件夹和用于 proguard 映射的文件。

更新:我已将我的 .gitignore 用于 Android 开发放在网上

This is my standard Android .gitignore and .hgignore file. It usually works pretty well.

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.

糖果控 2024-12-28 01:15:57

我知道 GitHub 上的 github/gitignore 存储库有一个 android .gitignore 文件。这可能就是你想要的,因为它对于 Android 开发来说应该是非常通用的。

上述文件的实际内容:

# 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

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

The actual content of the mentioned 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
绝不服输 2024-12-28 01:15:57

这是我在 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

Here is the one I use in my Android projects, it supports both ADT and Android Studio, so it is good if you are working with a team.

# 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
旧话新听 2024-12-28 01:15:57

只需 github 即可为 Android 项目存储库生成 .gitignore

在此处输入图像描述

及其内容会像下面这样

# 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

Simply github can generate .gitignore for Android projects repositories

enter image description here

And its content will be like the following

# 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
殤城〤 2024-12-28 01:15:57

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

out/

这是默认构建 Artifacts 的位置)。

如果您不想分享您的 IntelliJ 项目内容,请忽略

.idea/

In Addition, if you use IDEA's IntelliJ, and you build Artifacts (and you should), then you might want to add:

out/

(that's where Artifacts are built by default).

And if you don't want to share your IntelliJ project stuff ignore

.idea/
半葬歌 2024-12-28 01:15:57

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

/bin/
/gen/

In my project root I have a file .gitignore. It contains:

/bin/
/gen/
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文