我使用Android Studio 3.3.2 每次我打开项目时,都会出现一条消息:由于批量更新,索引已暂停。
IDE捕获到错误:
java.lang.UnsupportedOperationException: Operation is not supported for read-only collection
at kotlin.collections.EmptyList.add(Collections.kt)
at com.android.tools.idea.gradle.run.MakeBeforeRunTaskProviderUtil.addBeforeRunTaskToConfig(MakeBeforeRunTaskProviderUtil.java:109)
at com.android.tools.idea.gradle.run.MakeBeforeRunTaskProviderUtil.fixConfigurationsMissingBeforeRunTask(MakeBeforeRunTaskProviderUtil.java:65)
at com.android.tools.idea.gradle.project.FixAndroidRunConfigurationsAction.actionPerformed(FixAndroidRunConfigurationsAction.java:75)
at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:255)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:272)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.lambda$null$2(ActionManagerImpl.java:1356)
at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:195)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.lambda$tryToExecuteNow$3(ActionManagerImpl.java:1313)
at com.intellij.openapi.wm.impl.FocusManagerImpl.lambda$doWhenFocusSettlesDown$2(FocusManagerImpl.java:199)
at com.intellij.util.ui.UIUtil.invokeLaterIfNeeded(UIUtil.java:3094)
at com.intellij.ide.IdeEventQueue.ifFocusEventsInTheQueue(IdeEventQueue.java:189)
at com.intellij.ide.IdeEventQueue.executeWhenAllFocusEventsLeftTheQueue(IdeEventQueue.java:138)
at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:190)
at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:196)
at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.doWhenFocusSettlesDown(IdeFocusManagerImpl.java:63)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.tryToExecuteNow(ActionManagerImpl.java:1312)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.lambda$tryToExecute$1(ActionManagerImpl.java:1297)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.tryToExecute(ActionManagerImpl.java:1300)
at com.android.tools.idea.gradle.project.FixAndroidRunConfigurationsAction.executeAction(FixAndroidRunConfigurationsAction.java:99)
at com.android.tools.idea.gradle.project.FixAndroidRunConfigurationsAction.perform(FixAndroidRunConfigurationsAction.java:62)
at com.android.tools.idea.gradle.project.RunConfigurationChecker.lambda$ensureRunConfigsInvokeBuild$0(RunConfigurationChecker.java:70)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:315)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:447)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:431)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:415)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:817)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:758)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:394)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
我必须转到“文件”>无效的缓存/重新启动才能解决该问题。 有人知道如何使用无效的缓存对其进行修复吗?
答案 0 :(得分:2)
尝试使用新的Android Studio版本重新导入您的项目。
还尝试使缓存无效并重新启动。
File > Invalidate Cache & Restart > Just Restart
如果此解决方案不起作用,请尝试仅按消息右侧的播放按钮。这件事在我身上发生了很多次。