Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio - Remove Module - IncorrectOperationException: Must not change document outside command or undo-transparent action

I'm trying to remove/delete a module I've in my project.

I go to "Module Settings" and then I select my module and press the "-" (minus) button. It ask's me if I really want to delete it and I do press "yes". Then this Exception is genereated:

12:53:05 ExtensionException: org.intellij.lang.batch.runner.BatchRunConfigurationProducer: org.intellij.lang.batch.runner.BatchRunConfigurationProducer
12:53:10 IncorrectOperationException: Must not change document outside command or undo-transparent action. See com.intellij.openapi.command.WriteCommandAction or com.intellij.openapi.command.CommandProcessor: Must not change document outside command or undo-transparent action. See com.intellij.openapi.command.WriteCommandAction or com.intellij.openapi.command.CommandProcessor

If I got back to module settings my module is not there anymore but it is still in the project tree. I re-start android studio and go back to module settings and my module is back there again.

Anyone has this problem? How can I fix this?

Using android studio 0.5.1

like image 808
dazito Avatar asked Mar 14 '14 11:03

dazito


People also ask

How do I delete a module in Android Studio?

Step 1: First, go to the project section on the left-hand side of the Android studio. Step 2: Right-click on the project whose module you want to delete and go to the option of Load/Unload modules. Click on the module which you want to delete and click on unload button.

What is module Android studio?

Modules. A module is a collection of source files and build settings that allow you to divide your project into discrete units of functionality. Your project can have one or many modules, and one module may use another module as a dependency. You can independently build, test, and debug each module.

How do I uninstall a module?

The Remove-Module cmdlet removes the members of a module, such as cmdlets and functions, from the current session. If the module includes an assembly ( . dll ), all members that are implemented by the assembly are removed, but the assembly is not unloaded.


2 Answers

It's a bug; I haven't tested it to see if it will be fixed in 0.5.2, but there are exceptions of this sort all over the place that are really annoying at the moment.

As a workaround, remove the reference to your module in your settings.gradle file and click the Sync Project with Gradle Files button. Your module files will still be on disk and you will be able to see them from the Project view in the IDE, but they won't be linked into the code any more, and you can delete the files if you wish.

UPDATE

It's bug https://code.google.com/p/android/issues/detail?id=67220 and will be fixed in the 0.5.2 or 0.5.3 release.

like image 71
Scott Barta Avatar answered Sep 30 '22 20:09

Scott Barta


Right click the project > Open Module Settings

enter image description here

select the module you want to remove (In my case its app2)

then click the "-" (Delete) button on the top.

enter image description here

That's it, your module is removed from project now. To remove the folder, just delete it.

like image 26
Rohit Avatar answered Sep 30 '22 19:09

Rohit