Each module has to have a unique path

2016: It could be because of a .gitmodules including two entries with the same paths, but square/assertj-android issues 174 points out to another file:

This usually is the result of old iml files. Delete them all and re-import.

Weird, removing the .iml and reimporting worked.

Update 2020: as commented by ArashYounesi in issue 174, Android Studio V4.0 seems to resolve the problem.


The best way to fix this problem is:

Go to Tools-> Android -> Sync Project with Gradle Files

That works for me.


The best way to fix the .iml files (by recreating them) is to do this:

  1. Close the project in Android Studio
  2. In Android Studio, New > Import Project

That fixed it for me, and it was a lot easier than the other stuff I tried (and a lot less complex).

I believe that rewrites the .iml files with you do that.

What did I try? I tried Build > clean/rebuild project, File > Invalidate caches/restart, and Sync Project with Gradle Files. I was going to manually erase my .iml files but then I found out about this solution and it worked.