4

I have the following entries in my .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:

<orderEntry type="library" exported="" scope="TEST" name="guice-3.0-no_aop" level="project" /> 

FYI, the build.gradle part to add external libraries:

... 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.

Thanks!

2 Answers 2

1

The IDEA official documentation is clear about that :

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.

Source : How to manage IntelliJ IDEA projects under Version Control Systems

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.

Sign up to request clarification or add additional context in comments.

4 Comments

By doing that, the next time someone clones a tree, and import the project in AS, the iml files will be modified and will show up as changed / deleted in the git status.
The .iml files should not be added to VCS in Android Studio / Gradle projects. They can be constantly changing. The .gradle files are enough for Gradle to build the .iml files and import the project.
I agree with you. The official IDEA doc is not really clear. I have added a link to github's android gitignore file
I would add .idea/modules.xml to the ignore along with ignoring the *.iml files. Try taking an existing project, rename the directory the project is in and open it Android Studio. You will get changes to your iml files AND lines added .idea/modules.xml
1

This issue is fixed, as of Android Studio v0.2.7.

1 Comment

I'm using version 1.5.1 and I still get this problem. I am not uploading any iml files as understand that these should be generated when importing the project, but they are not. Whenever my friend clone my project he get a error dialog saying there are two missing iml files.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.