应该是在我的.gitignore了一个Android Studio项目是什么? [英] What should be in my .gitignore for an Android Studio project?

查看:248
本文介绍了应该是在我的.gitignore了一个Android Studio项目是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文件应该在我的.gitignore了一个Android Studio项目是什么?

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

我见过几个例子,所有的包括.iml但的IntelliJ文档说.iml必须包含在你的源代码控制。

I have seen several examples that all include .iml but IntelliJ docs say that .iml must be included in your source control.

推荐答案

更新:
由于Android的工作室1.0,新项目与此gitignore文件创建:

Update: Since Android Studio 1.0, new projects are created with this gitignore file:


.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build

验证它是否适合你的需要,如果没有,请继续阅读。

Verify if it suits your needs and if not, read on.

previous:

一个迟到的答案,但没有一个答案在这里和<一个href=\"http://stackoverflow.com/questions/16640566/which-files-shouldnt-be-checked-in-into-version-control-in-android-studio\">here是正确的金钱对我们来说...

A late answer but none of the answers here and here was right on the money for us...

所以,这里是我们的gitignore文件:

So, here's our gitignore 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

# 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/

#NDK
obj/

可选 - 用于旧项目格式,添加此部分,将gitignore文件:

Optional - for older project format, add this section to your gitignore file:


/*/out
/*/*/build
/*/*/production
*.iws
*.ipr
*~
*.swp

此文件应位于项目的根文件夹,而不是项目的模块文件夹内。

This file should be located in the project's root folder and not inside the project's module folder.

编辑备注:


  1. 由于版本0.3+似乎可以提交和推送的 * IML 的build.gradle 文件。如果你的项目是基于摇篮:在新打开/导入对话框,你应该检查使用自动导入复选框并标记使用默认gradle这个包装(推荐)单选按钮。所有路径现在相对的@George建议。

  1. Since version 0.3+ it seems you can commit and push *.iml and build.gradle files. If your project is based on Gradle: in the new open/import dialog, you should check the "use auto import" checkbox and mark the "use default gradle wrapper (recommended)" radio button. All paths are now relative as @George suggested.

更​​新答案

这篇关于应该是在我的.gitignore了一个Android Studio项目是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆