mbmc
mbmc

Reputation: 5105

Android Studio import project with gradle changes iml files

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!

Upvotes: 4

Views: 13508

Answers (2)

mbmc
mbmc

Reputation: 5105

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

Upvotes: 1

R&#233;mi F
R&#233;mi F

Reputation: 1335

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.

Upvotes: 1

Related Questions