Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to undo deleting a module in android Studio

I just deleted a module that contained the source code of my application. For this reason, I cannot debug and play my application in the emulator. In the Project view the folder does exist but in the android view doesn't exist.

Please help!

like image 468
Vasilisfoo Avatar asked Dec 24 '22 18:12

Vasilisfoo


1 Answers

If you removed just the module not it's contents (through Project Structure dialog) and your module folder is now considered just a generic folder by Android Studio, here's how to bring it back:

Switch to Project mode (of the Project pane), open file .idea/modules.xml (or just hit Ctrl[Cmd] + Shift + N and search for modules.xml)

Add a <module /> tag corresponding to your accidentally deleted module, do Gradle Sync and the module folder will once again be recognized as such.

Here's a sample

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/MODULE_NAME/MODULE_NAME.iml" filepath="$PROJECT_DIR$/MODULE_NAME/MODULE_NAME.iml" />
      <module ...
    </modules>
  </component>
</project>
like image 80
Ivan Bartsov Avatar answered Dec 30 '22 18:12

Ivan Bartsov