如何在Android Studio中删除模块

本文翻译自:How to delete a module in Android Studio

Is there a way to delete a module within Android Studio? 有没有办法在Android Studio中删除模块? When I right click on a module I can't find an option for deletion, is it elsewhere? 当我右键单击一个模块时,找不到删除选项,它是否在其他位置?


#1楼

参考:https://stackoom.com/question/1876o/如何在Android-Studio中删除模块


#2楼

(Editor's Note: This answer was correct in May 2013 for Android Studio v0.1, but is no longer accurate as of July 2014, since the mentioned menu option does not exist anymore -- see this answer for up-to-date alternative). (编者注:此答案在2013年5月对于Android Studio v0.1是正确的,但在2014年7月时不再正确,因为上述菜单选项已不存在-有关最新替代方法,请参见此答案 ) 。

First you will have to mark it as excluded. 首先,您必须将其标记为已排除。 Then on right click you will be able to delete the project. 然后右键单击您将能够删除该项目。

如何在Android Studio中删除模块

如何在Android Studio中删除模块


#3楼

As I saw that in Android Studio 0.5.1, you have to close your project by doing simply File -> Close Project then move your mouse over the project which you want to delete then keep your mouse on the same project and press delete then click on "OK" button that would delete your project from Android Studio. 正如我在Android Studio 0.5.1中看到的那样,您必须通过简单地执行File-> Close Project关闭项目,然后将鼠标移到要删除的项目上,然后将鼠标放在同一项目上,然后按Delete,然后单击点击“确定”按钮,这将从Android Studio中删除您的项目。

如何在Android Studio中删除模块

如何在Android Studio中删除模块


#4楼

I'm currently running the 0.5.8 version of Android Studio and I can't even find the "Mark folder as" option when I right click, what I do is: 我当前正在运行Android Studio的0.5.8版本,右键单击时甚至找不到“标记文件夹为”选项,我的工作是:

Right click on project -> Click on Show in Explorer and then just delete it from there. 右键单击项目->单击“在资源管理器中显示”,然后从此处将其删除。

You can achieve the same result by deleting it directly through Windows Explorer. 您可以通过直接通过Windows资源管理器将其删除来达到相同的结果。 That's the only way I've been able to get rid of Projects I did not want anymore. 这是我能够摆脱不再想要的项目的唯一方法。 Oh and of course, this also removes it from the hard disk. 哦,当然,这也会将其从硬盘中删除。


#5楼

The "Mark as Excluded" option isn't there anymore. “不再标记为已排除”选项不再存在。

The current (Android Studio 0.8.x - 2.2.x ) way to do this is via the Project Structure dialog. 当前的(Android Studio 0.8.x-2.2.x )方法是通过“ 项目结构”对话框。 It can be accessed via "File -> Project Structure" or by right-clicking on a Module and selecting "Module Settings". 可以通过“文件->项目结构”或右键单击模块并选择“模块设置”来访问它。

如何在Android Studio中删除模块

Then select the module, and click the "minus" button to remove it. 然后选择模块,然后单击“减号”按钮将其删除。

如何在Android Studio中删除模块

The directory will still be visible in the "Project" view (though not in the "Android" view) since it's not actually deleted, but it will no longer be treated as a module. 该目录在“项目”视图中仍然可见(尽管在“ Android”视图中不可见),因为它实际上并未删除,但不再被视为模块。

If you want, you can then physically delete the files it by right-clicking on it and pressing "Delete". 如果需要,可以通过右键单击文件并按“删除”来物理删除该文件。


#6楼

After doing what's referred in [this answer]: https://*.com/a/24592192/82788 完成[此答案]中提到的内容后: https : //*.com/a/24592192/82788

Select the module(since it's still visible on the Project view),pressing Delete button on the keyboard can delete this module on disk.(Before doing what's referred in that answer, the Delete button has no effect.) 选择模块(因为它仍然在项目视图中可见),按键盘上的Delete键可以在磁盘上删除该模块。(在执行该答案中提到的操作之前,Delete按钮无效)。