dazito
dazito

Reputation: 7980

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

Upvotes: 12

Views: 12984

Answers (2)

Rohit
Rohit

Reputation: 1550

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.

Upvotes: 14

Scott Barta
Scott Barta

Reputation: 80010

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.

Upvotes: 24

Related Questions