如何在子目录中移动模块? [英] How can I move a module inside a subdirectory?

查看:58
本文介绍了如何在子目录中移动模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要编写很多琐碎模块,我不想在它们之间隐藏主要模块.出于这个原因,我想要一个这样的目录树:

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:

Project
|-module1
|-module2
+-directory
    |-module3
    |-module4
    +-module5

问题:如果我将模块移动到一个新文件夹中,Android Studio 找不到它们.

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?

推荐答案

我建议在 Android Studio 中关闭项目,在操作系统中手动移动目录,并更新项目的 settings.gradle 文件指向新位置中的模块.使用您的示例,更新后的 settings.gradle 文件将如下所示:

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'

然后在 Android Studio 中重新打开项目,并确保它将项目与新的 Gradle 文件同步(它应该自动同步,但如果没有,请单击它的工具栏按钮).

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).

这篇关于如何在子目录中移动模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆