我怎样才能移动子目录中的模块? [英] How can I move a module inside a subdirectory?

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

问题描述

我需要写很多的琐碎的模块,我不希望隐藏他们之间的主要模块。为此,我想有这样的目录树:

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

问题:如果我搬到一个新的文件夹中的模块的Andr​​oid 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中的项目,在OS手动移动的目录,并更新项目的 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中的项目,并确保它与同步新摇篮文件的项目(它应该自动完成,但如果没有,请单击它的工具栏按钮)。

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天全站免登陆