14
votes

After updating to Android Studio 3.2 Beta 1, I started getting the following error for two different projects:

Gradle sync failed: Already disposed!

There is no error with Android Studio 3.1.3, and there was no error with various canary versions of Android Studio 3.2 before updating to beta 1.

I already tried everything I can think of (e.g. complete cleaning of project, including all generated .gradle/.iml/.idea files/folders, as well as a complete invalidate cache and restart of Android Studio) without success. The build works as expected from command line using Gradle.

This is not a duplicate of Android Studio Gradle Already disposed Module

EDIT

The event log is showing

Unable to save plugin settings: The plugin org.jetbrains.android failed to save settings and has been disabled. Please restart Android Studio

In the "IDE Fatal Errors" window, I am seeing the following exception:

'Gradle: backport-util-concurrent:backport-util-concurrent:3.1@jar' already disposed: --------------Creation trace: 
java.lang.Throwable
    at com.intellij.openapi.util.TraceableDisposable.<init>(TraceableDisposable.java:45)
    at com.intellij.openapi.roots.impl.libraries.LibraryImpl.<init>(LibraryImpl.java:103)
    at com.intellij.openapi.roots.impl.libraries.LibraryImpl.<init>(LibraryImpl.java:69)
    at com.intellij.openapi.roots.impl.libraries.LibraryTableBase$LibraryModel.readExternal(LibraryTableBase.java:327)
    at com.intellij.openapi.roots.impl.libraries.LibraryTableBase.loadState(LibraryTableBase.java:64)
    at com.intellij.openapi.roots.impl.libraries.LibraryTableBase.loadState(LibraryTableBase.java:30)
    at com.intellij.configurationStore.ComponentStoreImpl.doInitComponent(ComponentStoreImpl.kt:375)
    at com.intellij.configurationStore.ComponentStoreImpl.initComponent(ComponentStoreImpl.kt:331)
    at com.intellij.configurationStore.ComponentStoreImpl.initPersistenceStateComponent(ComponentStoreImpl.kt:121)
    at com.intellij.configurationStore.ComponentStoreImpl.initComponent(ComponentStoreImpl.kt:96)
    at com.intellij.openapi.components.impl.PlatformComponentManagerImpl.initializeComponent(PlatformComponentManagerImpl.java:54)

EDIT2:

More recent version of Android Studio 3.2 are having the same issue.

5
Did you try closing and re-opening the project? Sometimes the updates fail to update the project structure accordingly.m0skit0
@m0skit0 Yes, as mentioned in the question, I removed all generated IntelliJ files, restarted and invalidated Android Studio, and tried to open the project again.friederbluemle
Later versions of Android Studio 3.2 did not resolve the issue and I am still having the same problem with the very latest 3.3 canary 1 version.friederbluemle

5 Answers

15
votes

As it turned out, the problem was that I was trying to open a project directory that was a symlink to the actual location (on the same partition). Gradle (on command line) had no issues building the project from the symlinked location, however, opening it in Android Studio resulted in the obscure and non helpful error described above.

14
votes

Simple solution

    1.Delete module folder and modules.xml file under .idea folder. 
    2.Close Android Studio
    3.Reopen and sync
3
votes

Possible duplicate problem:
Android Studio 3.0 - Unable to save settings: Failed to save settings. Please restart Android Studio Android Studio 3.0 - Unable to save settings: Failed to save settings. Please restart Android Studio

This worked for me: Delete the .idea folder.

1) Go to File--> Settings -->Plugins Disable any plugins not loaded (i.e. red in color) @friederbluemle This may not apply to you.

2) Enable the one plugin, Android Support

3) Right-click on your 'app' directory (contains your module gradle.build file) in Android Studio and select 'Show in Explorer' --- this opens that directory.

4) Quit Android Studio. Get out of any and all instances of Android Studio to allow you to then delete the fold, .idea, in that directory.

5) Restart AS, you'll notice the project will not come up -- you'll have to pick in the dialog window that appears. That's ok. Pick it, and it will 'rebuild' the folder, .idea.

6) Go to File--> Settings -->Plugins Enable any and all plugins if any.

2
votes

What worked for me was going to Android Studio File and Invalidate/Restart options.

1
votes

What worked for me is as follows

  1. Delete the .idea folder
  2. Close Android Studio
  3. Reopen Android Studio and allow it sync your project all over.