[android] Android Studio Gradle Already disposed Module

I have installed Android Studio version 1.0.1. I have imported my projects from eclipse and it works fine. Then I deleted a module and reimported it into my Android Studio project. The gradle build says "BUILD SUCCESSFUL" but it pops up an alert window with the message

Failed to complete Gradle execution. Cause: Already disposed: Module: 'MYMODULENAME'

I can't start my app now. Any idea what I can do?

Edit: I solved the problem with the following instructions:

  1. Switch project view from Android to Project
  2. Remove entry include 'MYMODULENAME' in settings.gradle
  3. The blue box in the module symbol don't show. Then you can delete the module in the context menu
  4. Import the module

This question is related to android android-studio android-gradle-plugin

The answer is


In my case, same as in this question, it happened becayse I had my project in a symbolic link directory. After reopening the project in the real directory and reconfiguring gradle (File -> Sync with Gradle files) the problem went away. Shame on you, Android Studio!


I figured out this problem by:

  1. ./gradlew clean
  2. Restart Android Studio

works for me: File -> Invalidate Caches / Restart... -> Invalidate and Restart


I also face this problem sometimes. Click on gradle console in bottom bar of android studio, at right side. It will show the exact error in logs. My problem was that I had compile SDK 22 and imported appcomact library was of sdk 23.


For Solve this issue take it this simple steps.

  1. Find the .idea folder in your Android studio under the Folder Project.
  2. In .idea --> Find this one. .idea/.modules
  3. Simple Delete that .modules folder and restart Your studio.
  4. when it reopens gradle sync Automatically and also recreate .modules folder and files.
  5. Error has gone !

I had the same problem, after delete some gradle files (of aws)

i solved it by mark them "ignore gradle"

I believe it is not the best answer but it solve it for me

Gradle (at the right bar)--> right click on the problematic gradle --> ignore


For me this happened when i deleted a module and built a new one with the same package name Solution:

Clean & Restart Studio


For me this happened when I removed a module and tried to build the project:

Simple solution was to Invalidate the cache & Restart.

Android Studio>File>Invalidate Caches>Invalidate & Restart


Simplest solution. (Try this first).

  1. Quit and Restart Android studio. (Quit not close)

  2. Build > Clean your project if needed.


below solution works for me

  1. Delete all .iml files
  2. Rebuild project

If gradle clean and/or Build -> Clean Project didn't help try to re-open the project:

  • Close the project
  • Click "Open an existing Android Studio project" on the "Welcome to Android Studio" screen enter image description here
  • Select gradle file to open

Warning Be aware it's a destructive operation - you're going to loose the project bookmarks, breakpoints and shelves


Had a similar issue when working with RN components in my Android project and the only way to get around this issue was to ignore the gradle project.

To do this:

  • Click on the gradle tab on the right hand side of AS
  • Right click the gradle module which is causing an issue
  • Click "Ignore Gradle Project"
  • Perform a gradle sync which should be successful now
  • If you need this module perform the 4 above steps again, this time when right click on the gradle project it'll show "Unignore Gradle Project"
  • Gradle sync should now work

No idea what causes this but I've had this happen to me when using React Native Maps.

Note: If you're still having issues following this. Try to refresh the gradle project which was causing issues.


  1. In the left pane, change to "Project" view.
  2. Delete MYMODULENAME.iml

For an alternative solution, check if you added your app to settings.gradle successfully

include ':app' 

I was having this issue because gradle and Android Studio were using a different path for the jvm. In the Event Log there was an option for AS and gradle to use the same path. Selecting this and then doing an invalidate cache & restart resolved the issue for me.


Sometimes gradlew clean or Invalidate Cache and Restart does not help, because these methods do not clean Android Studio specific files by themselves.

In this case, close AS and remove .idea directory and .iml file in a root project where settings.gradle file exists. This will make AS rebuild from the fresh ground.


Although the accepted answer didn't work for me (unfortunately I can't leave a comment), it led me in the right direction.

in .idea/libraries i found that there were some duplicate xml files (the duplicates were named with a 2 before the _aar.xml bit).

deleting those, restarting android studio and sync fixed the error


Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to android-studio

A failure occurred while executing com.android.build.gradle.internal.tasks "Failed to install the following Android SDK packages as some licences have not been accepted" error Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util This version of Android Studio cannot open this project, please retry with Android Studio 3.4 or newer WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' Flutter plugin not installed error;. When running flutter doctor ADB.exe is obsolete and has serious performance problems Android design support library for API 28 (P) not working Flutter command not found How to find the path of Flutter SDK

Examples related to android-gradle-plugin

WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' Android Material and appcompat Manifest merger failed Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve Failed to resolve: com.google.firebase:firebase-core:16.0.1 com.google.android.gms:play-services-measurement-base is being requested by various other libraries Invoke-customs are only supported starting with android 0 --min-api 26 error: resource android:attr/fontVariationSettings not found Exception : AAPT2 error: check logs for details Could not resolve com.android.support:appcompat-v7:26.1.0 in Android Studio new project Failed to resolve: com.android.support:appcompat-v7:27.+ (Dependency Error)