Android Studio Gradle Already disposed Module

2019-01-12 17:49发布

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 reimport it to my Android Studio project. The gradle build says "BUILD SUCCESSFUL" but it pops up a alert window with the message

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

I cant 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 dont show. Then you can delete the module in the context menu
  4. Import the module

10条回答
等我变得足够好
2楼-- · 2019-01-12 18:29

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

Clean & Restart Studio

查看更多
Bombasti
3楼-- · 2019-01-12 18:31

Simplest solution. (Try this first).

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

  2. Build > Clean your project if needed.

查看更多
SAY GOODBYE
4楼-- · 2019-01-12 18:33

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

查看更多
Rolldiameter
5楼-- · 2019-01-12 18:34

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.

查看更多
疯言疯语
6楼-- · 2019-01-12 18:39

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.

查看更多
神经病院院长
7楼-- · 2019-01-12 18:39

I figured out this problem by:

  1. ./gradlew clean
  2. Restart Android Studio
查看更多
登录 后发表回答