How to repair an Eclipse/Android installation? PNG load problems in the Graphical XML editor

喜你入骨 提交于 2019-12-20 03:12:15

问题


For quite a while my Eclipse environment with the Android plug-in was running smoothly. Somewhere along the line of updates applied during the Software updates process it broke. The first problem that started happening was the loss of the "button" Form Widget graphics when running the Android plug-in Graphical Editor for layout files. I get the following related errors in the Error log:

!MESSAGE voice_recog.xml: android.webkit.WebView
!MESSAGE main_new.xml: Failed lot load /Developer/android-sdk-mac_x86-1.5_r3/platforms/android-11/data/res/drawable-hdpi/btn_default_normal.9.png
!STACK 0
javax.imageio.IIOException: Error reading PNG metadata

I located the png file on my hard disk and launched the image viewer from Finder. It displayed without error. I don't know why the IDE is having trouble loading it into the Graphical Editor. If you look at the detailed Error Log dump at the end of the post you will see that the Exception occurring is a java.io.EOFException ("Caused by: java.io.EOFException").

I noticed that one of the updates installed Android-12 on my hard disk and that the IDE is looking for PNG's in the Android-11 directory. However as I stated before, the file does exist in the Android-11 path shown in the error messages. I'm just pointing this out in case it may indicate some other problem in my setup.

NOTE: I tried switching the Graphical Layout editor to a different device from "3.7 inch WVGA" to several of the others and I got even more PNG file load errors than before (a lot more) and also a ClassCast Exception. I also tried switching the Android Platform from 3.0 to my target 1.6 and that did not help either. It's as if there is something just broken with the PNG file loading code now. I'm hoping not to do a full re-install of Eclipse and the ADT, especially since I could end up right back in the same trouble spot, so if anyone has experienced these problems and solved them, please respond.

Here is the full Error Log trace for the original failed load of the PNG file:

!ENTRY com.android.ide.eclipse.adt 4 0 2011-06-23 04:07:39.972
!MESSAGE web2voice_main_new.xml: Failed lot load /Developer/android-sdk-mac_x86-1.5_r3/platforms/android-11/data/res/drawable-hdpi/btn_default_normal.9.png
!STACK 0
javax.imageio.IIOException: Error reading PNG metadata
at com.sun.imageio.plugins.png.PNGImageReader.readMetadata(PNGImageReader.java:695)
at com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1314)
at com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1601)
at javax.imageio.ImageIO.read(ImageIO.java:1400)
at javax.imageio.ImageIO.read(ImageIO.java:1322)
at com.android.ninepatch.GraphicsUtilities.loadCompatibleImage(GraphicsUtilities.java:37)
at com.android.ninepatch.NinePatch.load(NinePatch.java:96)
at com.android.layoutlib.bridge.impl.ResourceHelper.getNinePatchDrawable(ResourceHelper.java:279)
at com.android.layoutlib.bridge.impl.ResourceHelper.getDrawable(ResourceHelper.java:190)
at com.android.layoutlib.bridge.android.BridgeResources.getDrawable(BridgeResources.java:162)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:832)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:769)
at com.android.layoutlib.bridge.impl.ResourceHelper.getDrawable(ResourceHelper.java:214)
at com.android.layoutlib.bridge.android.BridgeTypedArray.getDrawable(BridgeTypedArray.java:693)
at android.view.View.<init>(View.java:2471)
at android.widget.TextView.<init>(TextView.java:368)
at android.widget.Button.<init>(Button.java:108)
at android.widget.Button.<init>(Button.java:104)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:501)
at android.view.LayoutInflater.createView(LayoutInflater.java:576)
at com.android.layoutlib.bridge.android.BridgeInflater.onCreateView(BridgeInflater.java:83)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:644)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669)
at com.android.layoutlib.bridge.android.BridgeInflater.createViewFromTag(BridgeInflater.java:128)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:76)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:702)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:79)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:702)
at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
at android.view.LayoutInflater.inflate(LayoutInflater.java:367)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:315)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:314)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:324)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1510)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1347)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1078)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.activated(GraphicalEditorPart.java:904)
at com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditor.pageChange(LayoutEditor.java:403)
at org.eclipse.ui.part.MultiPageEditorPart$2.widgetSelected(MultiPageEditorPart.java:290)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3783)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1375)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1398)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1383)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1195)
at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:2743)
at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1429)
at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:257)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3783)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1375)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1398)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1383)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1195)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3629)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3284)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
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:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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:592)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
Caused by: java.io.EOFException
at javax.imageio.stream.ImageInputStreamImpl.readFully(ImageInputStreamImpl.java:330)
at java.io.DataInputStream.readUTF(DataInputStream.java:565)
at javax.imageio.stream.ImageInputStreamImpl.readUTF(ImageInputStreamImpl.java:309)
at com.sun.imageio.plugins.png.PNGImageReader.parse_iTXt_chunk(PNGImageReader.java:443)
at com.sun.imageio.plugins.png.PNGImageReader.readMetadata(PNGImageReader.java:652)
... 80 more

-- roschler


回答1:


I got around this problem by taking Eclipse out of Android 3.0 in the top right corner of the Graphical Layout box. I dropped the version down to Android 2.3.3 and once it finished loading this version I was in the clear. The 'button' png loaded just fine.



来源:https://stackoverflow.com/questions/6627770/how-to-repair-an-eclipse-android-installation-png-load-problems-in-the-graphica

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!