Project already contains module with this name -- Android Studio

I have encountered this. And I deleted the folder which below my project with the module name I set before, then I can import a module with same name again.

Hope this helps you.


Switch to the Project View. Then open .idea/modules.xml. Find and delete the line that corresponds to the module. Then Invalidate Caches and Restart. That's it.


If somebody faces this issue, except removing the Folder containing the old module also remove from the settings.gradle file the line corresponding to the old module: include ':youroldmodule'. If you dont remove that line manually, 2 modules with the same name will appear when trying to add module dependency.


I solved the problem through this way:

  1. Open Module Settings(Mac: command + down; Windows: F4) and delete the module.
  2. Delete the module folder on the disk. You will find it at ~/AndroidStdioProjects/YourApplicationName/ModuleName.
  3. Import the Module.