74

When I Checkout a project form Google Cloud, Android Studio sais: "2 modules cannot be loaded. You can remove them from the project" and I cannot see the project. The error is in the iml files app.iml and ProjectName.iml.

Thanks!

1
  • 1
    you can't see the code? but if you checkout you have to see it no? Commented Feb 29, 2016 at 17:34

7 Answers 7

118

Delete the *.iml files and rebuild the project (Build > Rebuild), it should be ok after that.

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

6 Comments

Android Studio automatically suggested this Solution ! +1
...ok, fine, but what is the solution to not get these warnings?
@turingtested these files are generated from the IDE and sometimes they are out of sync (i.e. you remane a module, you change dependencies). But I haven't seen this problem for a while with the newer version of android studio. I don't really have a solution since this problem was easily to fix when you rebuild the project.
Exit Android Studio, delete *.iml and .idea directory and re-import. Works for me.
wow!!.. that's work for me. if I add what I did additionally, I import the project as a new one. Not from the recent project. I removed the project from the recent list.
|
37

The best way to get rid of this problem is below:

1- close the project

2- close Android Studio IDE

3- delete the .idea directory

4- delete all .iml files

5- open Android Studio IDE and import the project again

1 Comment

This suggestion works for me.
9

As was already answered here the best solution is deleting all .iml files, but it could be done just Refreshing Gradle Project at Gradle tab> right click on your project > Refresh Gradle Project.

Then a Clean and Rebuild should be done also.

Edit:

The screenshot:

enter image description here

Comments

8

Removing modules.xml file under the /.idea folder solved my issue.

1 Comment

underrated fixed my flutter heirarchy thanks
7

I think you can take the IDE automatic advice of deleting the xxx.iml files

1 Comment

I did and it worked. Initially I thought the advice will make things worse but that is far from the truth
2

I had this issue in Android Studio 3.4 when I loaded an old project. I found some XML files in the .idea folder, including the file .idea/modules.xml.

It contained multiple <module fileurl="..."> tags, some of these were duplicates of existing modules but these had incorrect paths, in the fileurl attribute. I closed the project, deleted these duplicate tags, and reopened the project. This resolved the error for me.

Comments

1

For my Flutter project, it was not enough to delete the .idea directory in the project root, I had to delete also .idea folder in android directory.

1- close the project

2- close Android Studio IDE

3- delete the .idea directory, but also android/.idea directory!

4- delete all .iml files

5- open Android Studio IDE and reopen project

That's it, happy coding.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.