org.eclipse.swt.SWTException:尝试打开 AndroidManifest.xml 时出现“小部件已释放”

Posted

技术标签:

【中文标题】org.eclipse.swt.SWTException:尝试打开 AndroidManifest.xml 时出现“小部件已释放”【英文标题】:org.eclipse.swt.SWTException: “Widget is disposed” when trying to open AndroidManifest.xml 【发布时间】:2013-11-06 01:46:06 【问题描述】:

我正在运行 Windows 8 并使用 Eclipse Kepler Release 来创建 android 应用程序。

当我单击项目中的 AndroidManifest.xml 文件时,我会收到一条警报,其中显示以下错误消息:

Problems occurred when invoking code from plug-in: "org.eclipse.e4.ui.workbench.swt". 

异常堆栈跟踪:

org.eclipse.e4.core.di.InjectionException: org.eclipse.swt.SWTException: Widget is disposed
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
at org.eclipse.e4.core.internal.contexts.ContextObjectSupplier$ContextInjectionListener.update(ContextObjectSupplier.java:88)
at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:107)
at org.eclipse.e4.core.internal.contexts.EclipseContext.processScheduled(EclipseContext.java:328)
at org.eclipse.e4.core.internal.contexts.EclipseContext.set(EclipseContext.java:342)
at org.eclipse.e4.core.internal.contexts.EclipseContext.activate(EclipseContext.java:625)
at org.eclipse.e4.ui.internal.workbench.swt.ShellActivationListener$2.run(ShellActivationListener.java:120)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.e4.ui.internal.workbench.swt.ShellActivationListener.activate(ShellActivationListener.java:117)
at org.eclipse.e4.ui.internal.workbench.swt.ShellActivationListener.handleEvent(ShellActivationListener.java:73)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1262)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1056)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1081)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
at org.eclipse.swt.widgets.Decorations.WM_ACTIVATE(Decorations.java:1667)
at org.eclipse.swt.widgets.Shell.WM_ACTIVATE(Shell.java:2151)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4608)
at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:340)
at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1627)
at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2075)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4977)
at org.eclipse.swt.internal.win32.OS.BringWindowToTop(Native Method)
at org.eclipse.swt.widgets.Decorations.bringToTop(Decorations.java:231)
at org.eclipse.swt.widgets.Shell.open(Shell.java:1217)
at org.eclipse.jface.window.Window.open(Window.java:798)
at org.eclipse.ui.internal.statushandlers.InternalDialog.open(InternalDialog.java:327)
at org.eclipse.ui.internal.statushandlers.WorkbenchStatusDialogManagerImpl.doAddStatusAdapter(WorkbenchStatusDialogManagerImpl.java:270)
at org.eclipse.ui.internal.statushandlers.WorkbenchStatusDialogManagerImpl.addStatusAdapter(WorkbenchStatusDialogManagerImpl.java:197)
at org.eclipse.ui.statushandlers.WorkbenchStatusDialogManager.addStatusAdapter(WorkbenchStatusDialogManager.java:156)
at org.eclipse.ui.statushandlers.WorkbenchErrorHandler.showStatusAdapter(WorkbenchErrorHandler.java:101)
at org.eclipse.ui.statushandlers.WorkbenchErrorHandler.handle(WorkbenchErrorHandler.java:57)
at org.eclipse.ui.internal.ide.IDEWorkbenchErrorHandler.handle(IDEWorkbenchErrorHandler.java:108)
at org.eclipse.ui.internal.WorkbenchErrorHandlerProxy.handle(WorkbenchErrorHandlerProxy.java:36)
at org.eclipse.ui.statushandlers.StatusManager.handle(StatusManager.java:189)
at org.eclipse.ui.internal.JFaceUtil$3.show(JFaceUtil.java:70)
at org.eclipse.jface.util.SafeRunnable.handleException(SafeRunnable.java:67)
at org.eclipse.core.runtime.SafeRunner.handleException(SafeRunner.java:75)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:44)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:864)
at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1152)
at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1256)
at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:275)
at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:269)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:309)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
Caused by: org.eclipse.swt.SWTException: Widget is disposed
at org.eclipse.swt.SWT.error(SWT.java:4397)
at org.eclipse.swt.SWT.error(SWT.java:4312)
at org.eclipse.swt.SWT.error(SWT.java:4283)
at org.eclipse.swt.widgets.Widget.error(Widget.java:472)
at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:344)
at org.eclipse.swt.widgets.Widget.addDisposeListener(Widget.java:214)
at org.eclipse.e4.ui.css.swt.engine.CSSSWTEngineImpl.hookNativeWidget(CSSSWTEngineImpl.java:52)
at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.getElement(AbstractCSSEngine.java:919)
at org.eclipse.e4.ui.css.core.dom.ElementAdapter.getElement(ElementAdapter.java:336)
at org.eclipse.e4.ui.css.swt.dom.CTabFolderElement.item(CTabFolderElement.java:52)
at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.applyStyles(AbstractCSSEngine.java:481)
at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.applyStyles(AbstractCSSEngine.java:405)
at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.applyStyles(AbstractCSSEngine.java:481)
at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.applyStyles(AbstractCSSEngine.java:405)
at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.applyStyles(AbstractCSSEngine.java:481)
at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.applyStyles(AbstractCSSEngine.java:405)
at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.applyStyles(AbstractCSSEngine.java:481)
at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.applyStyles(AbstractCSSEngine.java:405)
at org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine.applyStyles(ThemeEngine.java:497)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$10.setClassnameAndId(PartRenderingEngine.java:1267)
at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.setCSSInfo(SWTPartRenderer.java:92)
at org.eclipse.e4.ui.workbench.renderers.swt.WBWRenderer.styleStack(WBWRenderer.java:179)
at org.eclipse.e4.ui.workbench.renderers.swt.WBWRenderer.trackActivePart(WBWRenderer.java:148)
at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
... 71 more

【问题讨论】:

关闭和打开 Eclipse IDE 解决了这个问题。我正在将 .java 和 .xml 文件从一个项目复制并粘贴到另一个项目。我仍然不知道是什么原因造成的。 同样的问题,同样的解决方法。使用: - Android 开发者工具 - 构建:v22.6.2-1085508 【参考方案1】:

重启 Eclipse IDE 解决了这个问题。

【讨论】:

重启成功。我试图按照developer.android.com/google/play-services/setup.html 上提供的说明为 gcm 目的导入“google-play-services_lib”并遇到此错误。观察到重新启动“project.properties”文件中的值后会自动更改。【参考方案2】:

日食 - 开普勒 / 月球 / 火星

对我来说我去了

...\.metadata.plugins\org.eclipse.e4.workbench // 文件夹位置。

并删除了所有的内容

workbench.xmi

并重新启动应用程序。

为我工作,希望对你有用。

注意:在进行更改之前最好先备份。

【讨论】:

也为 MyEclipse 工作过。谢谢阿伦【参考方案3】:

通过命令提示符启动 Eclipse,输入命令:eclipse -clean 解决了我的问题。

【讨论】:

找不到文件清理,我得到了 谢谢卡米拉!我已经自己尝试过 -clean 但没有运气。【参考方案4】:

最好关闭Eclipse并重新启动Eclipse而不是重新启动Eclipse,它会更快。

【讨论】:

有什么区别?【参考方案5】:

我对文件名做了一点改动。

/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi 上面是workbench.xmi的原名

我在适合我的 workbenchold.xmi 上重命名它。

一旦你重命名它必须从市场更新你的 eclipse 和插件,再加上一点点你的“显示视图”设置。

【讨论】:

【参考方案6】:

清理服务器并重启 eclips IDE。

【讨论】:

【参考方案7】:
1. Close Eclipse
2. cd <work-project>
3. mvn clean install
4. Start Eclipse

【讨论】:

以上是关于org.eclipse.swt.SWTException:尝试打开 AndroidManifest.xml 时出现“小部件已释放”的主要内容,如果未能解决你的问题,请参考以下文章