CodenameOne Gui Builder在Intellij Idea中的NPE崩溃

时间:2017-06-29 13:25:06

标签: intellij-idea codenameone

*更新*

也许我在这里做错了但是如果是这样的话,我不清楚是什么。这是一个已知的问题?我是否应该寻找特定的地方,以确定是否存在未满足的依赖关系等(如Java版本或IDE版本或插件或?)。请帮忙。

情景:

  • 我有最新的IntelliJ Idea版本(14.1.7)
  • 使用java -version
  • 从IDE终端确认Java版本为1.8.0_91
  • 刚刚更新为CN1插件版本3.7.1
  • 刚刚启动了一个新项目,可以使用新的GUI Builder。

以下是重现的步骤:

  1. 我右键点击包裹并选择"新表格"并给它一个名字
  2. 创建表单java文件和.gui文件
  3. 我右键单击java文件并选择" CN1-> Gui Builder"
  4. 然后Idea使用以下详细信息来解决错误事件(NoSuchMethodError):并且GUI生成器不会显示

    堆栈追踪:

    com.intellij.openapi.vfs.VfsUtil.getChildren(Lcom/intellij/openapi/vfs/VirtualFile;Lcom/intellij/openapi/vfs/VirtualFileFilter;)Ljava/util/List;
    java.lang.NoSuchMethodError: com.intellij.openapi.vfs.VfsUtil.getChildren(Lcom/intellij/openapi/vfs/VirtualFile;Lcom/intellij/openapi/vfs/VirtualFileFilter;)Ljava/util/List;
        at com.codename1.plugin.intellij.actions.GUIBuilderAction.actionPerformed(GUIBuilderAction.java:73)
        at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:182)
        at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter$1.run(ActionMenuItem.java:312)
        at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:958)
        at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:124)
        at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:282)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
        at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:109)
        at com.intellij.ui.plaf.beg.BegMenuItemUI.doClick(BegMenuItemUI.java:512)
        at com.intellij.ui.plaf.beg.BegMenuItemUI.access$300(BegMenuItemUI.java:44)
        at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:532)
        at java.awt.Component.processMouseEvent(Component.java:6535)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
        at java.awt.Component.processEvent(Component.java:6300)
        at java.awt.Container.processEvent(Container.java:2236)
        at java.awt.Component.dispatchEventImpl(Component.java:4891)
        at java.awt.Container.dispatchEventImpl(Container.java:2294)
        at java.awt.Component.dispatchEvent(Component.java:4713)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
        at java.awt.Container.dispatchEventImpl(Container.java:2280)
        at java.awt.Window.dispatchEventImpl(Window.java:2750)
        at java.awt.Component.dispatchEvent(Component.java:4713)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
        at java.awt.EventQueue.access$500(EventQueue.java:97)
        at java.awt.EventQueue$3.run(EventQueue.java:709)
        at java.awt.EventQueue$3.run(EventQueue.java:703)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
        at java.awt.EventQueue$4.run(EventQueue.java:731)
        at java.awt.EventQueue$4.run(EventQueue.java:729)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
        at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:734)
        at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:565)
        at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
        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)
    

    *更新* 基于一些好的建议,我意识到我的Idea版本已经多大了,所以我已经升级到2017.1.4。我删除并重新安装了3.7插件,我的测试项目仍无法启动GUI Builder,但现在有不同的错误和堆栈跟踪:

    java.lang.IndexOutOfBoundsException: Index: 0
        at com.intellij.util.containers.ContainerUtilRt$EmptyList.get(ContainerUtilRt.java:308)
        at com.codename1.plugin.intellij.actions.GUIBuilderAction.actionPerformed(GUIBuilderAction.java:74)
        at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:215)
        at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:232)
        at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.lambda$actionPerformed$0(ActionMenuItem.java:309)
        at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:929)
        at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:136)
        at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:299)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
        at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$fireActionPerformed$0(ActionMenuItem.java:116)
        at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:86)
        at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:109)
        at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:118)
        at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:122)
        at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:116)
        at com.intellij.ui.plaf.beg.BegMenuItemUI.doClick(BegMenuItemUI.java:513)
        at com.intellij.ui.plaf.beg.BegMenuItemUI.access$300(BegMenuItemUI.java:45)
        at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:533)
        at java.awt.Component.processMouseEvent(Component.java:6541)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
        at java.awt.Component.processEvent(Component.java:6306)
        at java.awt.Container.processEvent(Container.java:2236)
        at java.awt.Component.dispatchEventImpl(Component.java:4897)
        at java.awt.Container.dispatchEventImpl(Container.java:2294)
        at java.awt.Component.dispatchEvent(Component.java:4719)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
        at java.awt.Container.dispatchEventImpl(Container.java:2280)
        at java.awt.Window.dispatchEventImpl(Window.java:2746)
        at java.awt.Component.dispatchEvent(Component.java:4719)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
        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.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
        at java.awt.EventQueue$4.run(EventQueue.java:737)
        at java.awt.EventQueue$4.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:827)
        at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:651)
        at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:365)
        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)
    

2 个答案:

答案 0 :(得分:2)

显然,您安装的插件版本3.7.1与IntelliJ IDEA 14.1.7不兼容。开发人员错误地指出它兼容而不执行真正的测试。由于14.1.7很旧,以前没有人注意到这个问题。因此,要么更新当前的IntelliJ IDEA版本,请尝试手动安装一些较旧的插件版本,或file a bug to the plug-in developer

至于第二个问题,请check this answer

答案 1 :(得分:0)

事实证明,我的Idea配置有一个较旧的Java(Android!)SDK配置为新项目的默认值。这个默认设置导致新项目CREATION做了一些奇怪的事情,导致它无法使用GUI Builder。仅在我的项目配置中修复不正确的SDK并没有使GUI Builder在预先存在的项目中工作;相反,我需要使用正确的SDK集创建一个新项目,然后它开始工作。也许可能有一个步骤迫使CodenameOne在修复后“重新创建”或“重新生成”项目,但这对我来说并不明显。

@Shai Almog,我希望这至少可以为你提供一些关于这个问题如何发生的线索,这样你就可以防止它在将来影响他人。现在我的问题是解决。感谢所有人的帮助。