How can I move a module inside a subdirectory?


I need to write a lot of trivial modules and I don’t want to hide the main modules between them. For this reason I want to have a directory tree like this:


The problem: if I move the modules inside a new folder Android Studio doesn’t find them.

So, my question is: How can I move modules inside a directory?


I would recommend closing the project in Android Studio, moving the directories manually in your OS, and updating the project’s settings.gradle file to point to the modules in their new location. Using your example, the updated settings.gradle file will look like this:

include ':module1'
include ':module2'
include ':directory:module3'
include ':directory:module4'
include ':directory:module5'

Then re-open the project in Android Studio, and make sure it syncs the project with the new Gradle files (which it should do automatically, but if it doesn’t, click the toolbar button for it).

Answered By – Scott Barta

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published