5

我在安装了最新 Java 的 Mac 上。我安装了 Eclipse 4.2.0 并且刚刚下载了 Jelly Bean 4.1 (API 16) SDK。一切都是最新的。

我开始一个新项目并使用所有默认模板和值。我只是将我的应用称为“MyApp”之类的简单应用。

当我将按钮从工具箱拖到所见即所得编辑器时,按钮显示正常,我可以编辑 XML,一切都很好,等等。

但是当我拖动纯文本框时,我收到以下 Java 错误,并且我的整个 WYSIWYG 编辑器变为灰色。唯一能让它恢复原状的方法是从 XML 中删除代码并重新启动 Eclipse。如果我将代码粘贴回去,错误就会回来。

这是错误:

java.util.LinkedHashMap.eldest()Ljava/util/Map$Entry;
Exception details are logged in Window > Show View > Error Log

这是导致它的代码:

<EditText
    android:id="@+id/editText1"
    android:inputType="text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignTop="@+id/button1"
    android:layout_marginLeft="55dp"
    android:ems="10"
    android:hint="@string/hello_world" >

    <requestFocus />
</EditText>

我知道今天果冻豆是全新的,但有人对这里可能发生的事情有任何想法吗?

其他人可以重现这个问题吗?

顺便说一句,我不会因为其他文本字段类型(如密码、人名等)而崩溃。只有纯文本。

编辑:

这是来自 Eclipse 的堆栈跟踪:

java.lang.NoSuchMethodError: java.util.LinkedHashMap.eldest()Ljava/util/Map$Entry;
at android.util.LruCache.trimToSize(LruCache.java:206)
at android.util.LruCache.evictAll(LruCache.java:306)
at android.widget.SpellChecker.resetSession(SpellChecker.java:141)
at android.widget.SpellChecker.setLocale(SpellChecker.java:147)
at android.widget.SpellChecker.<init>(SpellChecker.java:112)
at android.widget.Editor.updateSpellCheckSpans(Editor.java:461)
at android.widget.Editor.onAttachedToWindow(Editor.java:212)
at android.widget.TextView.onAttachedToWindow(TextView.java:4455)
at android.view.View.dispatchAttachedToWindow(View.java:11755)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2424)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2424)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2424)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2424)
at android.view.AttachInfo_Accessor.setAttachInfo(AttachInfo_Accessor.java:37)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:329)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:331)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:325)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:372)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1640)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1391)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.onXmlModelChanged(GraphicalEditorPart.java:1353)
at com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditorDelegate.delegateXmlModelChanged(LayoutEditorDelegate.java:395)
at com.android.ide.eclipse.adt.internal.editors.common.CommonXmlEditor.xmlModelChanged(CommonXmlEditor.java:328)
at com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor$XmlModelStateListener.modelChanged(AndroidXmlEditor.java:1610)
at com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor.wrapEditXmlModel(AndroidXmlEditor.java:1084)
at com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor.wrapUndoEditXmlModel(AndroidXmlEditor.java:1160)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.MoveGesture.drop(MoveGesture.java:393)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GestureManager$CanvasDropListener.drop(GestureManager.java:652)
at org.eclipse.swt.dnd.DNDListener.handleEvent(DNDListener.java:90)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4134)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1458)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1481)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1271)
at org.eclipse.swt.dnd.DropTarget.drop(DropTarget.java:726)
at org.eclipse.swt.dnd.DropTarget.performDragOperation(DropTarget.java:740)
at org.eclipse.swt.dnd.DropTarget.dropTargetProc(DropTarget.java:454)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
at org.eclipse.swt.internal.cocoa.NSView.dragImage(NSView.java:150)
at org.eclipse.swt.dnd.DragSource.drag(DragSource.java:397)
at org.eclipse.swt.dnd.DragSource$1.handleEvent(DragSource.java:218)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4134)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1458)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1481)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1271)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3980)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3619)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1022)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:916)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:585)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:540)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
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:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)

这是我的会话信息:

eclipse.buildId=I20120608-1400
java.version=1.6.0_33
java.vendor=Apple Inc.
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US
Framework arguments:  -keyring /Users/ethanallen/.eclipse_keyring -showlocation
Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -keyring /Users/ethanallen/.eclipse_keyring -showlocation
4

3 回答 3

8

我认为您可能需要将以下内容添加到您的 EditText 中(直到工具更新为最新的 API 以解决此错误)。

 android:inputType="textNoSuggestions"

在这里查看我的回复:https ://stackoverflow.com/a/11276651/1449799

于 2012-06-30T18:46:12.700 回答
2

确认的错误:http ://code.google.com/p/android/issues/detail?id=33789

于 2012-07-04T00:46:57.717 回答
1

我测试了textNoSuggestions但它不起作用。

但是,当我设置:

android:inputType = "textPersonName"

它运作良好!请尝试一下。

于 2012-07-04T13:24:56.913 回答