4

In my ~/project/.idea/modules.xml file the 8th line is always repeated. If I delete it, the line is put back whenever I save (auto-save).

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/GoogleMapsForWork/GoogleMapsForWork.iml" filepath="$PROJECT_DIR$/GoogleMapsForWork/GoogleMapsForWork.iml" />
      <module fileurl="file://$PROJECT_DIR$/SAMRecipeApplication/SAMRecipeApplication.iml" filepath="$PROJECT_DIR$/SAMRecipeApplication/SAMRecipeApplication.iml" />
      <module fileurl="file://$PROJECT_DIR$/SAMStore/SAMStore.iml" filepath="$PROJECT_DIR$/SAMStore/SAMStore.iml" />
      <module fileurl="file://$PROJECT_DIR$/SillyAppStore.iml" filepath="$PROJECT_DIR$/SillyAppStore.iml" />
      <module fileurl="file://$PROJECT_DIR$/SillyAppStore.iml" filepath="$PROJECT_DIR$/SillyAppStore.iml" />
      <module fileurl="file://$PROJECT_DIR$/SillyAppStore/SillyAppStore-SillyAppStore.iml" filepath="$PROJECT_DIR$/SillyAppStore/SillyAppStore-SillyAppStore.iml" />
      <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
      <module fileurl="file://$PROJECT_DIR$/apptentive/apptentive.iml" filepath="$PROJECT_DIR$/apptentive/apptentive.iml" />
      <module fileurl="file://$PROJECT_DIR$/volley/volley.iml" filepath="$PROJECT_DIR$/volley/volley.iml" />
    </modules>
  </component>
</project>

I understand that there's some setting somewhere that insists on doubling this line (or it's created in two places), but I don't understand the intracies of the IDE well enough to track this error down. None of my co-workers have this problem; it's stumping everyone here.

This issue has been puzzling, but hasn't prevented me from working. It does cause problems with version control as this file is ALWAYS flagged as modified (prevents me from simply typing git add -A).

Any suggestions, other than wiping the project and starting fresh?

SMBiggs
  • 11,034
  • 6
  • 68
  • 83
  • Happens to me too, for three different modules (and always those three). If I add the duplicates, some time later IntelliJ may decide to remove those duplicates. – ris8_allo_zen0 Oct 14 '15 at 08:55
  • Ok, that's at least two people in the world with this problem. There has to be more. And a solution, right? Anyone, anyone? Bueller, Bueller? – SMBiggs Oct 15 '15 at 02:15
  • Mine is doing the same thing.. sort of. I have a line that says " which is the only line in the component section.. and it is duplicated repeatedly, seemingly at random. There are now 5 copies of this line in the file. Whenever I delete the dupes it just starts adding them in again... – alzee Jan 05 '16 at 13:27

2 Answers2

3

This seems to have been working for me:

  1. Close Android Studio
  2. Edit modules.xml with a text editor, remove the duplicate module entries
  3. Commit
  4. Reopen Android Studio

AS shouldn't change that file now. Also, it shouldn't show warnings like "project is already loaded".

ris8_allo_zen0
  • 1,537
  • 1
  • 15
  • 35
0

It's often happens when you first time open the project, and the solution is quite simple and easy. Just delete the original line and the duplicate line, then wait few minutes for Android Studio generate it again, after re-generate, it will never duplicate later.

For your situation, delete these two repeated lines, then wait few minutes for generate again.

<module fileurl="file://$PROJECT_DIR$/SillyAppStore.iml" filepath="$PROJECT_DIR$/SillyAppStore.iml" />
<module fileurl="file://$PROJECT_DIR$/SillyAppStore.iml" filepath="$PROJECT_DIR$/SillyAppStore.iml" />
Loyea
  • 3,359
  • 1
  • 18
  • 19