什么文件应该在我的。gitignore为一个Android工作室项目?
我见过几个包含。iml的例子,但是IntelliJ文档说。iml必须包含在你的源代码控制中。
什么文件应该在我的。gitignore为一个Android工作室项目?
我见过几个包含。iml的例子,但是IntelliJ文档说。iml必须包含在你的源代码控制中。
当前回答
我不同意所有这些答案。下面的配置非常适合我们组织的应用程序。
我忽略:
/构建 /。想法(可能有例外,见dalewking回答中的评论) * .iml local.properties
我想几乎每个人都同意/建造。
我厌倦了经常看到关于Gradle在/.idea中创建或删除的各种library.xml文件的消息。构建。当开发人员第一次签出项目时,gradle将在他们的本地运行,那么为什么这些XML文件需要版本控制呢?Android Studio也会生成/的剩余部分。当开发人员使用版本控制签出创建项目时,为什么该文件夹中的任何东西都需要进行版本控制?
如果*。Iml的版本是一个新用户将必须命名项目完全相同,当它被提交。既然这也是一个生成的文件,那么为什么首先要为它设置版本呢?
当地的。properties文件指向SDK文件系统上的绝对路径,因此绝对不应该对其进行版本控制。
编辑1:添加.gradle来忽略gradle缓存不应该被版本化的东西(感谢Vasily Makarov)。
编辑2:添加. ds_store现在我使用Mac。这个文件夹是Mac特定的,不应该被版本化。
另外注意:在构建发布版本时,您可能还想添加一个目录来放置签名密钥。
为方便复制/粘贴:
.gradle
/build
/.idea
*.iml
local.properties
.DS_Store
其他回答
不需要在源代码控件中添加以下任何内容:
.idea/
.gradle/
*.iml
build/
local.properties
所以你可以相应地配置hgignore或gitignore。
开发人员第一次克隆源代码控件时可以这样做:
Open Android Studio 导入项目 浏览构建。Gradle在克隆的存储库中并打开它
这是所有
PS: Android Studio将通过maven获得gradle插件,假设您的构建。Gradle看起来像这样:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.2'
}
}
allprojects {
repositories {
mavenCentral()
}
}
Android studio将生成.idea文件夹(包括workspace.xml,它不应该在源代码控制中,因为它是生成的)和.gradle文件夹的内容。
这种方法是eclipse友好的,因为源代码控制并不真正了解Android Studio。Android Studio只需要构建。Gradle导入项目并生成其余部分。
取决于你的项目格式是如何维护的:
你有两个选择:
基于目录的格式(您将有一个.idea文件夹,其中包含 项目特定文件) 基于文件的格式(配置文件为。iws和。ipr)
裁判: http://www.jetbrains.com/idea/webhelp/project.html
提交给版本控制的文件依赖于上述:
包括。idea文件夹到版本控制,排除workspace.xml和 tasks.xml 版本控制的.ipr文件和所有的.iml模块文件,排除 iws文件,因为它存储了用户特定的设置。
裁判: https://intellij-support.jetbrains.com/entries/23393067
编译:
#built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
# generated files
bin/
gen/
# Gradle files
.gradle/
build/
/*/build/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log
# Windows thumbnail db
Thumbs.db
# OSX files
.DS_Store
# Eclipse project files
.classpath
.project
# Android Studio
*.iml
.idea
#.idea/workspace.xml - remove # and delete .idea if it better suit your needs.
.gradle
build/
# Intellij project files
*.iml
*.ipr
*.iws
.idea/
使用gitignore提供的api。Io,你可以得到的是自动生成的。这里是gitignore.io/api/androidstudio的直接链接
### AndroidStudio ###
# Covers files to be ignored for android development using Android Studio.
# Built application files
*.apk
*.ap_
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class
# Generated files
bin/
gen/
out/
# Gradle files
.gradle
.gradle/
build/
# Signing files
.signing/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log
# Android Studio
/*/build/
/*/local.properties
/*/out
/*/*/build
/*/*/production
captures/
.navigation/
*.ipr
*~
*.swp
# Android Patch
gen-external-apklibs
# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
# NDK
obj/
# IntelliJ IDEA
*.iml
*.iws
/out/
# User-specific configurations
.idea/caches/
.idea/libraries/
.idea/shelf/
.idea/workspace.xml
.idea/tasks.xml
.idea/.name
.idea/compiler.xml
.idea/copyright/profiles_settings.xml
.idea/encodings.xml
.idea/misc.xml
.idea/modules.xml
.idea/scopes/scope_settings.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml
.idea/datasources.xml
.idea/dataSources.ids
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml
.idea/assetWizardSettings.xml
# OS-specific files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
# Legacy Eclipse project files
.classpath
.project
.cproject
.settings/
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.war
*.ear
# virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml)
hs_err_pid*
## Plugin-specific files:
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Mongo Explorer plugin
.idea/mongoSettings.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
### AndroidStudio Patch ###
!/gradle/wrapper/gradle-wrapper.jar
# End of https://www.gitignore.io/api/androidstudio
https://github.com/github/gitignore是很棒的收藏
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