我有一个 android studio 项目,我已经 checkin 了 git。我的 git 忽略文件看起来像:
# 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 project files
.classpath
.project
# Proguard folder generated by Eclipse
proguard/
# Intellij project files
*.iws
.idea/workspace.xml
.idea/tasks.xml
/gradle
当我去我的笔记本电脑拉下项目时,我不确定我是否应该在 android studio 中打开或导入以正确地进入项目。当我打开时,出现以下错误:
Cannot load module file 'D:\dev\android\projects\projectname\ProjectName.iml':
File D:\dev\android\projects\projectname\ProjectName.iml does not exist
即使该文件确实存在。
当我导入而不是打开 android studio 时要求提供 gradle home 的路径,我不确定要放入什么。我使用的是 android studio 0.4.3。
非常感谢任何帮助。
答案:
我能够通过打开而不是导入来构建项目。然而,在这个过程中,intellij 在我的项目的根目录下创建了一个额外的 iml 文件,它在我的桌面上不存在。不确定为什么创建它以及我是否需要它。我这辈子都想不出正确的方法将我的项目推送到 git,然后在另一台机器上恢复它,而不会导致生成大量新文件和破坏东西。
最佳答案
在你的 .gitignore 中使用 import 和 delete "/gradle" 忽略 .gradle 是可以的,但是/gradle 应该包含在 git 中。
至少这是我让它为我工作的方式。
关于android - 如何从 Git 导入 Android Studio 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21541303/