How to delete a module in Android Studio
Asked Answered
P

20

426

Is there a way to delete a module within Android Studio? When I right click on a module I can't find an option for deletion, is it elsewhere?

Plum answered 23/5, 2013 at 9:30 Comment(1)
I can't believe Android Studio makes such common operation so un-intuitive.Boeotia
T
666

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. It can be accessed via "File -> Project Structure" or by right-clicking on a Module and selecting "Module Settings".

enter image description here

Then select the module, and click the "minus" button to remove it.

enter image description here

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.

If you want, you can then physically delete the files it by right-clicking on it and pressing "Delete".

Triggerfish answered 6/7, 2014 at 2:28 Comment(11)
Why the android studio is so critical and confusingStraightforward
And than ... ? files are still cached and possibly referenced (modules.xml, ...). Is it safe to remove the whole module directory from disk?Gibeonite
@Gibeonite Yes, you can then delete it safely.Triggerfish
If you wanted to delete entire project would you still need to remove app from project structure first? Would just deleting the project's folder cleanly remove it?Confront
@michael I'm not sure I understand the question... if you're going to discard the full project then there's no point in removing the modules from it first.Triggerfish
ok, that's what i wanted to check. several tutorials, like this one on youtube: youtube.com/watch?v=lvFCRl_zxsw, instruct to remove app and activity modules first before deleting project folder for a clean project delete.Confront
@matiash, I am removing the module as you described but it gets automatically re-added. Edit: removed from gradle as G_V suggested below, now it is fine.Kamalakamaria
I'm using Android 1.3.2 and this methods works, too!Healthful
What a big c**p they put in the world with Android Studio!Calchas
I think Android framework and Android Studio have this thing for extra complicating simple things. Only now Google has got into senses and it is becoming developer friendly day by day.Emma
If you remove the module like this, it won't be reflected in the VCS. So the way I do it is to manually delete the directory, remove it from settings.gradle and remove any implementations from other modules.Corpuz
F
98

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

First you will have to mark it as excluded. Then on right click you will be able to delete the project.

Step 1

Step 2

Flickinger answered 23/5, 2013 at 9:41 Comment(3)
After doing the steps in this answer, the project remains in the list, and I have to restart Android Studio to make the project disappear from the list. For whoever experiencing the same thing, please restart Android Studio. :)Sachiko
You can just refresh to achieve sameFlickinger
I'm sure this 'was' a great answer, but it is out of date. The one referencing Android Studio 0.8.1 worked for me.Eblis
M
66

In Android Studio 1.0 - 1.1b4, I found this to be the easiest way to remove a module:

  1. Open settings.gradle found under Gradle Scripts

  2. Delete module's name from the include statement

  3. Sync Project with Gradle Files

  4. Optionally, delete it manually from the project folder

Example

Old:

include ':app', ':greendao'

New:

include ':app'
Marissamarist answered 10/12, 2014 at 15:13 Comment(1)
This is the true way to get ghost modules from popping back up.Waugh
D
18

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.

screenshot 1

enter image description here

Dubois answered 12/3, 2014 at 15:29 Comment(4)
You are just removing the project from the Recent Projects list. The project's content will still be available on disk.Pleasing
hmm Afaik that is not possible to delete from disk in Android Studio as ADT doesDubois
I concur, and that's a bummer.Pleasing
This answer is about deleting a project, but the question was about deleting a module.Melanymelaphyre
P
9

In Android studio v1.0.2

Method 1

Go to project structure, File -> Project Structure..., as the following picture show, click - icon to remove the module.enter image description here

Method 2

Edit the file settings.gradle and remove the entry you are going to delete. e.g. edit the file from include ':app', ':apple' to include ':app'.

That will work in most of the situation, however finally you have to delete the module from disk manually if you don't need it anymore.

Permeance answered 30/12, 2014 at 6:6 Comment(0)
N
9

If you want to delete manually (for me it was easier), follow this:

Let's get this example with "teste".

1 - First change the explorer to "project" and open "settings.gradle";

enter image description here

2 - Delete the module you want;

enter image description here

3 - Go to your root folder of your project and delete the module folder.

enter image description here

Nonobjective answered 28/10, 2019 at 11:18 Comment(1)
This is still the best method. No Issue has occurred.Thordis
F
8

Here is for Android studio 2.3.3 I did not find any Project Structure under File menu. So here are steps in pictures

enter image description here

enter image description here

enter image description here enter image description here

Fiery answered 20/6, 2017 at 23:13 Comment(0)
S
5

Step-1: Right Click on Project-->Open Module Option Right Click on Project and Select modules

Step-2: Click Your Module --> click (-)sign done on Top Left in PopUp, then press ok button. Select Module want to delete

Step-3: After removing module from the project After removing module from the project

Step-4: Again do right-click in Project, Select Delete menu to Remove whole content from Disk space(i.e.folder). enter image description here

Step-5: Delete the content of the module from the disk by clicking done. Delete the content of the module from the disk by clicking done

Squires answered 6/7, 2020 at 13:43 Comment(0)
J
4

Deleting is such a headache. I am posting the solution for Android Studio 1.0.2.


Step 1: Right click on the "Project Name" selected from the folder hierarchy like shown.
Note: It can also be deleted from the Commander View from right hand side of your window by right clicking the project name and selecting delete from the context menu.

Step 1

Step 2: The project is deleted(seemingly) but gradle seems to keep the record of the project app folder(Check it by clcking on the Gradle View). Now go to File->Close Project.

Step 3: Now you are at the start window. Move the cursor on the in recent project list. Press Delete.

Step 4: Delete the folder from the explorer by moving or deleting it actually. This location is in your_user_name->Android Studio Projects->...

Step 5: Go back to the Android studio window and the project is gone for good. You can start a new project now.

Juncture answered 13/2, 2015 at 11:21 Comment(0)
V
4
  1. edit the project's settings.gradle file: delete the module name (, ':xxxxx') where xxxxx is the module name to be deleted

  2. using the file explorer delete the module folder

by the way, the current version of the Android Studio (v3.1.2) throws an exception and exits the removing with an error while I'm removing the module through Module Settings => selected module => - (minus)

Best Regards, thanks)

Verduzco answered 26/4, 2018 at 10:9 Comment(0)
S
4

Steps to follow Remove Modules in Android Studio:3.1.4.

  1. Goto Project-->Right Click on Module (FolderIcon-GreywithGreenColorDot) -->Load/UnLoadModules in PopUp -->Select Which Module to Unload in PopUpWindowRefer this Image

  2. Again RightClick on Module (FolderIcon-OrangeColor) -->Remove module.

  3. Finally, RightClick again on Module (FolderIcon-GreyColor) -->Delete.

    Note:Incase Project Enabled with Git please remove module from settings.gradle, otherwise deleted module.iml will show in project module list(Reference Link).gradle.xml which is located in project/.idea/gradle.xml--remove a module from here.

Hope it helps. Thank-you.

Squires answered 24/9, 2018 at 7:58 Comment(0)
N
4

Android Studio delete a module

settings.gradle[About] file is responsible for modules in the project

  1. Remove <module_name> from settings.gradle. Also it can contains projectDir setting
  2. remove module from <module_name> build.gradle
implementation project(':<module_name>')
  1. Sync Project with Gradle Files
Nagoya answered 30/5, 2021 at 14:8 Comment(0)
F
3

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:

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

Falkner answered 11/5, 2014 at 1:0 Comment(0)
L
3

For the latest Android Studio Versions, to delete a module in Android Studio :

1. Open File -> Project Structure
2. Choose the Modules section from the left column.
3. In the right panel opened ,select the module you want to delete.
4. After selecting the module tap the (-) icon on the top to delete the respective module.
Leucomaine answered 25/9, 2021 at 10:48 Comment(0)
G
2

Assuming the following:

  • You are working with Android Studio 1.2.1 or 1.2.2 (I don't have the latest yet, will edit this again when I do).
  • Your Project Tool Window is displaying one of the following views: "Project", "Packages", "Android" or "Project Files"

You can delete an Android Studio module as follows:

  1. In the Project Tool Window click the module you want to delete.
  2. Between the Tool Bar and the Project Tool Window the tool bar you will see two "chips" that represent the path to the selected module, similar to: your-project-name > selected-module-name
  3. Right click on the selected-module-name chip. A context menu with multiple sections will appear. In the third section from the bottom there will be a section that contains "Reformat Code..", "Optimize Imports..." and "Delete".
  4. Select "Delete" and follow any prompts.
Gouty answered 12/8, 2015 at 5:47 Comment(0)
M
2

The most reliable way I have found to do this it to go to project structure and remove it from dependencies and remove it from your setting.gradle file.

It will appear as if it is fully deleted at his point but it is not. If you try to re add the module it will say that it already exist in the project.

The final step is to go to the location of your project using file explorer etc and delete the module.

This work 100% of the time on studio 1.3.1

Morehouse answered 26/8, 2015 at 22:8 Comment(0)
D
2

In android-studio version 2. just go

Right Click on Project-->Open Module Option-->Click Your Module --> click sign done then press ok button.

Duyne answered 24/4, 2016 at 17:51 Comment(0)
H
0

After doing what's referred in [this answer]: https://mcmap.net/q/80835/-how-to-delete-a-module-in-android-studio

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

Hypoxanthine answered 16/9, 2014 at 7:36 Comment(0)
P
0

Remove from File > File Structure > Dependencies > - button. Then if it is stull there you can remove the module by going to the settings.gradle file and removing it from the include line.

Pittel answered 2/4, 2015 at 1:51 Comment(0)
R
0

To delete a module in Android Studio 2.3.3,

  • Open File -> Project Structure
  • On Project Structure window, list of modules of the current project gets displayed on left panel. Select the module which needs to be deleted.
  • Then click - button on top left, that means just above left panel.
Rapturous answered 6/10, 2017 at 6:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.