Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Already disposedjava.lang.AssertionError when switching to design view in Android Studio

I get the following error when switching to Design View in Android Studio, nothing changed in the activity and it used to work before:

java.lang.AssertionError: Already disposed
    at com.intellij.openapi.components.impl.ComponentManagerImpl.getPicoContainer(ComponentManagerImpl.java:263)
    at com.intellij.openapi.components.impl.ComponentManagerImpl.getPicoContainer(ComponentManagerImpl.java:55)
    at com.intellij.openapi.components.ServiceManager.getService(ServiceManager.java:40)
    at com.intellij.openapi.roots.impl.DirectoryIndex.getInstance(DirectoryIndex.java:31)
    at org.jetbrains.android.dom.AndroidXmlExtension.isAvailable(AndroidXmlExtension.java:52)
    at com.intellij.xml.XmlExtension.getExtension(XmlExtension.java:48)
    at com.intellij.xml.XmlExtension.getExtensionByElement(XmlExtension.java:59)
    at com.intellij.psi.impl.source.xml.XmlTagImpl.computeNamespaceMap(XmlTagImpl.java:893)
    at com.intellij.psi.impl.source.xml.XmlTagImpl.initNamespaceMaps(XmlTagImpl.java:857)
    at com.intellij.psi.impl.source.xml.XmlTagImpl.getAttributeValue(XmlTagImpl.java:631)
    at com.android.tools.idea.rendering.PsiResourceItem$1.getDefaultIndex(PsiResourceItem.java:160)
    at com.android.ide.common.rendering.api.ArrayResourceValue.getValue(ArrayResourceValue.java:95)
    at com.android.ide.common.resources.ResourceResolver.resolveResValue(ResourceResolver.java:272)
    at com.android.ide.common.resources.ResourceResolver.resolveResValue(ResourceResolver.java:263)
    at com.android.ide.common.resources.ResourceResolver.resolveValue(ResourceResolver.java:258)
    at com.android.layoutlib.bridge.android.BridgeContext.obtainStyledAttributes(BridgeContext.java:705)
    at android.widget.AbsSpinner.<init>(AbsSpinner.java:71)
    at android.widget.Spinner.<init>(Spinner.java:165)
    at android.widget.Spinner.<init>(Spinner.java:144)
    at android.widget.Spinner.<init>(Spinner.java:128)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at android.view.LayoutInflater.createView(LayoutInflater.java:594)
    at android.view.BridgeInflater.onCreateView(BridgeInflater.java:86)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
    at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:131)
    at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:755)
    at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
    at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:758)
    at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
    at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:758)
    at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:373)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:399)
    at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:336)
    at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:332)
    at com.android.tools.idea.rendering.RenderService$3.compute(RenderService.java:542)
    at com.android.tools.idea.rendering.RenderService$3.compute(RenderService.java:535)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:934)
    at com.android.tools.idea.rendering.RenderService.createRenderSession(RenderService.java:535)
    at com.android.tools.idea.rendering.RenderService.render(RenderService.java:577)
    at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$7$2.compute(AndroidDesignerEditorPanel.java:501)
    at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$7$2.compute(AndroidDesignerEditorPanel.java:494)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:945)
    at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$7.run(AndroidDesignerEditorPanel.java:494)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310)
    at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227)
    at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    at com.intellij.util.Alarm$Request$1.run(Alarm.java:297)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:695)

Any clues on this ?

like image 834
spacebiker Avatar asked Nov 19 '13 11:11

spacebiker


1 Answers

Try to select File -> Invalidate Caches / Restart

I had a similar issue with Android Studio, and found this blog where the solution is posted.

I've posted this answer hoping it'll help other people who will search for this error. My Android Studio version is 0.6.1 Preview version

UPDATE: In IntelliJ 2021.3 a new feature, named Repair IDE, has been introduced which can be invoked from File -> Repair IDE or by searching for this action via Cmd + Shift + A (Mac) or Ctrl + Shift + A (Windows). Android Studio Dolphin, built on IntelliJ 2021.3, is the first to have this feature.

like image 153
Zsolt Boldizsár Avatar answered Nov 07 '22 23:11

Zsolt Boldizsár