I have the following entries in my .gitignore:
我的.gitignore中有以下条目:
...
*.iml
.idea/
...
After I git clone a fresh repo (I don't have any iml or .idea in the project), I open Android Studio (v0.2.5), import the project successfully and compile without issues. Now, if I want to edit some files, IntelliJ is showing the red wavy thing almost everywhere, because it can't find external libraries. I realized that when the iml files are regenerated, the external libraries are added like this:
在我git clone一个新的repo后(我在项目中没有任何iml或.idea),我打开Android Studio(v0.2.5),成功导入项目并编译没有问题。现在,如果我想编辑一些文件,IntelliJ几乎无处不在地显示红色波浪状的东西,因为它无法找到外部库。我意识到重新生成iml文件时,会添加外部库,如下所示:
<orderEntry type="library" exported="" scope="TEST" name="guice-3.0-no_aop" level="project" />
FYI, the build.gradle part to add external libraries:
仅供参考,添加外部库的build.gradle部分:
...
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
...
So now, if I bring the Project Structure pop-up and change the scope from Test to Compile, the red waves disappear, and everything is back to normal.
所以现在,如果我弹出项目结构弹出窗口并将范围从测试更改为编译,红色波浪消失,一切都恢复正常。
I'd like to know if it's something that I do wrong on my side, or if it's a bug? Also, regarding the way to handle iml files (version them or not), I couldn't find any straight answer. Everyone seem to do have their own way.
我想知道这是我在我身边做错了什么,或者它是否是一个错误?另外,关于处理iml文件的方式(版本是否版本),我找不到任何直接的答案。每个人似乎都有自己的方式。
Thanks!
2 个解决方案
#1
1
The IDEA official documentation is clear about that :
IDEA官方文件清楚地表明:
Share all the files under .idea directory in the project root except the workspace.xml and tasks.xml files which store user specific settings, also share all the .iml module files.
共享项目根目录下.idea目录下的所有文件,除了存储用户特定设置的workspace.xml和tasks.xml文件外,还共享所有.iml模块文件。
Source : How to manage IntelliJ IDEA projects under Version Control Systems
来源:如何在版本控制系统下管理IntelliJ IDEA项目
EDIT : But, sharing iml files seems to be wrong. Best thing is to use a similar gitignore file and to import the project in AndroidStudio for each developer.
编辑:但是,共享iml文件似乎是错误的。最好的方法是使用类似的gitignore文件并在AndroidStudio中为每个开发人员导入项目。
#2
1
This issue is fixed, as of Android Studio v0.2.7.
从Android Studio v0.2.7开始,此问题已修复。
#1
1
The IDEA official documentation is clear about that :
IDEA官方文件清楚地表明:
Share all the files under .idea directory in the project root except the workspace.xml and tasks.xml files which store user specific settings, also share all the .iml module files.
共享项目根目录下.idea目录下的所有文件,除了存储用户特定设置的workspace.xml和tasks.xml文件外,还共享所有.iml模块文件。
Source : How to manage IntelliJ IDEA projects under Version Control Systems
来源:如何在版本控制系统下管理IntelliJ IDEA项目
EDIT : But, sharing iml files seems to be wrong. Best thing is to use a similar gitignore file and to import the project in AndroidStudio for each developer.
编辑:但是,共享iml文件似乎是错误的。最好的方法是使用类似的gitignore文件并在AndroidStudio中为每个开发人员导入项目。
#2
1
This issue is fixed, as of Android Studio v0.2.7.
从Android Studio v0.2.7开始,此问题已修复。