在Android Studio中发现错误时该怎么办?

时间:2018-04-12 20:46:42

标签: java android android-studio

我在Android Studio的堆栈跟踪中收到以下错误:

  

java.lang.IllegalStateException:无法从写入操作开始查找用法。请改为考虑Application.invokeLater()。

有谁知道我应该从哪里开始查看我的代码,以确切地找到我的代码的哪一部分导致这种情况发生?

如果遇到此错误,该怎么办?可以选择将其提交给Google,但与此同时,我的项目会受到干扰。我搜索了这个,但没有得到合适的答案。

注意:由于出现此错误,我在Android项目中遇到了意外行为。我在其他项目中也多次遇到过这个问题,在那里我遇到了意外和无意开放活动等问题。在我的一个项目中,我得到了这个错误的后果,因为我的预览" XML中的部分未显示。

请帮助,如果有必要,请问我是否有更多信息。

完全堆积痕迹:

  

java.lang.IllegalStateException:无法从下面开始查找用法   写行动。请改为考虑Application.invokeLater()。     在   com.intellij.usages.impl.UsageViewManagerImpl.doSearchAndShow(UsageViewManagerImpl.java:132)     在   com.intellij.usages.impl.UsageViewManagerImpl.searchAndShowUsages(UsageViewManagerImpl.java:123)     在   com.intellij.codeInspection.nullable.NullableStuffInspection $ NavigateToNullLiteralArguments.invoke(NullableStuffInspection.java:144)     在   com.intellij.codeInspection.LocalQuickFixOnPsiElement.applyFix(LocalQuickFixOnPsiElement.java:102)     在   com.intellij.codeInspection.LocalQuickFixOnPsiElement.applyFix(LocalQuickFixOnPsiElement.java:92)     在   com.intellij.codeInspection.LocalQuickFixOnPsiElement.applyFix(LocalQuickFixOnPsiElement.java:26)     在   com.intellij.codeInspection.ex.QuickFixWrapper.invoke(QuickFixWrapper.java:88)     在   com.intellij.codeInsight.intention.impl.IntentionActionWithTextCaching $ MyIntentionAction.invoke(IntentionActionWithTextCaching.java:181)     在   com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.lambda $ invokeIntention $ 3(ShowIntentionActionsHandler.java:209)     在   com.intellij.openapi.application.WriteAction.run(WriteAction.java:91)     在   com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.invokeIntention(ShowIntentionActionsHandler.java:211)     在   com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.lambda为$ null $ 1(ShowIntentionActionsHandler.java:186)     在   com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)     在   com.intellij.openapi.application.TransactionGuardImpl.submitTransactionAndWait(TransactionGuardImpl.java:153)     在   com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.lambda $ chooseActionAndInvoke $ 2(ShowIntentionActionsHandler.java:185)     在   com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:149)     在   com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:109)     在   com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:99)     在   com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:85)     在   com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.chooseActionAndInvoke(ShowIntentionActionsHandler.java:184)     在   com.intellij.codeInsight.intention.impl.IntentionListStep.lambda $ applyAction $ 1(IntentionListStep.java:293)     在   com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:195)     在   com.intellij.ui.popup.AbstractPopup.lambda为$ null $ 7(AbstractPopup.java:1431)     at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)     在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)     在java.awt.EventQueue.dispatchEvent(EventQueue.java:732)at   com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:822)     在   com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:650)     在   com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:366)     在   java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)     在   java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)     在   java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)     在   java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)     在   java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)     在java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

0 个答案:

没有答案