Android Studio - Gradle sync failed: Already disposed - android

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.

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.

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

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.

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

What worked for me is as follows
Delete the .idea folder
Close Android Studio
Reopen Android Studio and allow it sync your project all over.

Related

Android Studio 4.0.0 - Unable to save settings: Failed to save settings. Please restart Android Studio

from a week I was updated my Android Studio version to stable version 4.0.0 then I am started getting this errors in my studio and unable to build the app.
Unable to save plugin settings: The plugin org.jetbrains.android failed to save settings and has been disabled. Please restart Android Studio
But I forcefully enabled all plugins in my Studio by going to File-->Settings-->Plugins --> All are enabled.
Select Embedded JDK in Android Studio
Try that:
delete the .idea folder in the android project folder where you faced this problem.
Close Android Studio. Now navigate to your projects .idea folder and rename the workspace.xml file to workspace-o.xml and delete a workspace.xml~ if it exists (i.e., AS has a corrupt workspace layout file).
This should fix the problem. Restart AS and configure the workspace back they way you like it (i.e., it will start with a simple view: View/Tools Windows/Project etc.).
I started my first project in Android Studio and my answer may not be the correct one. I ran into this problem during building the My Activity project. It always came back with this error asking me to restart. Finally I thought that the controlled folder file access is preventing me. I temporarily switched-off the protection(against Ransomware in Windows 10) and tried the Build. I stopped getting these messages. But, I have other problems I am looking into.
I deleted the .idea folder and then I invalidated the cache (file-> invalidate Cache/Restart)
This fixed my issue.

Android Studio Open an existing Android Studio project doesn't work [duplicate]

Android Studio 3.4.2 can't open project on macOS 10.15 Beta (19A526h)
Open Android Studio -> press Open an existing Android Studio project -> select folder with project -> NOTHING happens
I can create new project though, but can't open existing one.
Is there anything i missing here? Any help is appreciated.
I have met the same problem. It works by dragging folder onto AndroidStudio directly.
I made it easier to open projects with Finder by associating all settings.gradle files with Android Studio and then launching that file to open a project. (I'm on Android Studio 4.2.2)
I find that Android Studio's behavior with launching project files is inconsistent. If you don't have any project open and you launch a project's gradle.properties file with Android Studio, then it will open the whole project, BUT if you do this when another project is open then it will just open the gradle.properties text file in the already open project! However, for some reason this issue is avoided with settings.gradle -- it always opens the whole project even if another project is already open.
This problem occurs with macbook M1 macOS monterey. I solved this by,
Open Settings in Android Studio
Select Edit Custom VM options..
Add this line to it: -Dide.mac.file.chooser.native=false
Restart Android Studio

Android studio : when re-import the project it show's error and given a strange floders

while re-importing my project android studio show's plenty of errors
after cleaning and re-importing my project i have got an red circle with ā€œJā€ on my java files and i'am enable to run my project
Make sure that your gradle version is defined properly.
It seems that this project was on another PC and you imported it on your computer. I think that probably a gradle version conflict occurred and you have two options:
one is to let android studio download gradle version specified in TlaProject (gradle 2.4)
another solution is to edit app level 'build.gradle' file and change its version to a version which is available on your machine (to see which version is available on your system, please check 'gradle' folder inside installation folder of android studio)
My problem was solved by updating the version of android studio .

Android Studio : Unable to delete original file

I'm very new to android and I just recently cloned an Android project.
When Android Studios performs the indexing once opening the project, i get this error all the time.
this is the error I get from Android Studio.
Error:(89, 0) Failed to delete original file 'C:\Users\myname\AppData\Local\Temp\gradle_download8065263342645015068bin'
after copy to 'C:\Users\myname\.gradle\caches\modules-2\files-2.1\com.android.tools.build\gradle\1.5.0\1c3d2b23212349ffbe6479fcb04732c5cddaf98b\gradle-1.5.0.pom'
Open File
Try the next step to "Refresh" your IDE (android studio)
Choose File | Invalidate Caches/Restart.
Another possible cause is the Anti-virus. It may block Gradle or Java
There can be multiple reasons for this error but are usually linked to Rights. I solved this by following these 2 different steps at different times.
Run Android Studio as Administrator
Check if the your project folder is read-only ? If yes, remove the read-only attribute from Folder Properties.
If Invalidate Caches/Restart doesn't work, change your GRADLE BUILD TOOL to any lower Version, or different Version untill it works
For me I got the error for Gragle 2.2.3, but fixed when I changed to 2.1.3, you can try with different newer versions from here Gradle Build Tools
I was able to solve my issue by disabling the Instant Run feature of android studio.

Android studio gradle deleted

I accidentally deleted some gradle files from where i Android studio is installed. I was following this tutorial to resolve another issue but it now even deleted some gradle files i cant even create a new project in Android studio. And cant build run or do anything. When i start android studio it shows me this error in following image:
If i open plugin manager it shows android support, cloud disabled like in this image:
In settings build tools it not does show gradle:
And in module settings it shows this:
Please someone guide me in this. I cant reinstall android studio, sdk and everything again as I have done many settings(installed plugins and git configs etc) in studio, so reinstalling everything is not an option. Any help?
One non-technical solution is to install another instance of Android Studio at different location on your system. You can then compare the directories of where where you deleted the files and copy over the files that are not there in your original installation.

Categories

Resources