如何解决 Android Studio 中的 IDE 错误?

How to resolve an IDE error in Android Studio?

我在使用 Android Studio 3.2.1 时遇到问题。当我想添加 onClick 事件处理程序时出现 IDE 错误。它也不会创建函数。我试着这样做:https://www.quora.com/How-can-I-resolve-an-IDE-error-in-Android-Studio 我也尝试重新安装,但没有帮助。 这是我的错误详细信息和一些屏幕截图: Add onClick Event Handler

    org.jetbrains.kotlin.asJava.classes.KtLightClassImpl
    com.intellij.util.IncorrectOperationException: org.jetbrains.kotlin.asJava.classes.KtLightClassImpl
at com.intellij.psi.impl.light.LightElement.add(LightElement.java:139)
at org.jetbrains.android.dom.AndroidCreateOnClickHandlerAction.addHandlerMethod(AndroidCreateOnClickHandlerAction.java:152)
at org.jetbrains.android.dom.AndroidCreateOnClickHandlerAction.lambda$addHandlerMethodAndNavigate(AndroidCreateOnClickHandlerAction.java:170)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1010)
at org.jetbrains.android.dom.AndroidCreateOnClickHandlerAction.addHandlerMethodAndNavigate(AndroidCreateOnClickHandlerAction.java:169)
at org.jetbrains.android.dom.AndroidCreateOnClickHandlerAction.invoke(AndroidCreateOnClickHandlerAction.java:124)
at com.intellij.codeInsight.intention.impl.config.IntentionActionWrapper.invoke(IntentionActionWrapper.java:67)
at com.intellij.codeInsight.intention.impl.IntentionActionWithTextCaching$MyIntentionAction.invoke(IntentionActionWithTextCaching.java:181)
at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.lambda$invokeIntention(ShowIntentionActionsHandler.java:211)
at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.invokeIntention(ShowIntentionActionsHandler.java:215)
at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.lambda$null(ShowIntentionActionsHandler.java:188)
at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)
at com.intellij.openapi.application.TransactionGuardImpl.submitTransactionAndWait(TransactionGuardImpl.java:153)
at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.lambda$chooseActionAndInvoke(ShowIntentionActionsHandler.java:187)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:137)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:95)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:85)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:71)
at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.chooseActionAndInvoke(ShowIntentionActionsHandler.java:186)
at com.intellij.codeInsight.intention.impl.IntentionListStep.lambda$applyAction(IntentionListStep.java:278)
at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:195)
at com.intellij.ui.popup.AbstractPopup.lambda$dispose(AbstractPopup.java:1398)
at com.intellij.util.ui.UIUtil.invokeLaterIfNeeded(UIUtil.java:2886)
at com.intellij.ide.IdeEventQueue.ifFocusEventsInTheQueue(IdeEventQueue.java:179)
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.IdeFocusManagerImpl.doWhenFocusSettlesDown(IdeFocusManagerImpl.java:56)
at com.intellij.ui.popup.AbstractPopup.dispose(AbstractPopup.java:1392)
at com.intellij.ui.popup.WizardPopup.dispose(WizardPopup.java:160)
at com.intellij.ui.popup.list.ListPopupImpl.dispose(ListPopupImpl.java:307)
at com.intellij.openapi.util.Disposer.execute(Disposer.java:48)
at com.intellij.openapi.util.Disposer.execute(Disposer.java:44)
at com.intellij.openapi.util.objectTree.ObjectNode.execute(ObjectNode.java:138)
at com.intellij.openapi.util.objectTree.ObjectNode.execute(ObjectNode.java:107)
at com.intellij.openapi.util.objectTree.ObjectTree.executeActionWithRecursiveGuard(ObjectTree.java:169)
at com.intellij.openapi.util.objectTree.ObjectNode.execute(ObjectNode.java:107)
at com.intellij.openapi.util.objectTree.ObjectTree.executeAll(ObjectTree.java:144)
at com.intellij.openapi.util.Disposer.dispose(Disposer.java:129)
at com.intellij.openapi.util.Disposer.dispose(Disposer.java:125)
at com.intellij.ui.popup.WizardPopup.disposeAllParents(WizardPopup.java:263)
at com.intellij.ui.popup.list.ListPopupImpl.handleNextStep(ListPopupImpl.java:442)
at com.intellij.ui.popup.list.ListPopupImpl._handleSelect(ListPopupImpl.java:396)
at com.intellij.ui.popup.list.ListPopupImpl.handleSelect(ListPopupImpl.java:342)
at com.intellij.ui.popup.list.ListPopupImpl$MyMouseListener.mouseReleased(ListPopupImpl.java:501)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)
at java.awt.Component.processMouseEvent(Component.java:6548)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3325)
at com.intellij.ui.popup.list.ListPopupImpl$MyList.processMouseEvent(ListPopupImpl.java:552)
at java.awt.Component.processEvent(Component.java:6313)
at java.awt.Container.processEvent(Container.java:2237)
at java.awt.Component.dispatchEventImpl(Component.java:4903)
at java.awt.Container.dispatchEventImpl(Container.java:2295)
at java.awt.Component.dispatchEvent(Component.java:4725)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4526)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4467)
at java.awt.Container.dispatchEventImpl(Container.java:2281)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4725)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
at java.awt.EventQueue.access0(EventQueue.java:98)
at java.awt.EventQueue.run(EventQueue.java:715)
at java.awt.EventQueue.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue.run(EventQueue.java:737)
at java.awt.EventQueue.run(EventQueue.java:735)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:822)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:759)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:423)
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)

这是一个错误。你无能为力。以下是类似错误报告的链接:

1.) https://youtrack.jetbrains.com/issue/KT-12850

2.) https://youtrack.jetbrains.com/issue/KT-26785

3.) https://youtrack.jetbrains.com/issue/KT-18291

截至目前,Kotlin 中还没有解决方案。但是,在 Java.

中工作正常