gpt4 book ai didi

java.lang.NoClassDefFoundError : org. apache.batik.dom.svg.SVGDOMImplementation

转载 作者:行者123 更新时间:2023-11-29 21:12:12 28 4
gpt4 key购买 nike

我在链接到我的 Android&LibGDX 项目的 Apache Batik 库时遇到了奇怪的问题。

但让我们从头开始,在 IntelliJ Idea 中我有一个包含三个模块的项目:Main、Android 和 Desktop。

enter image description here

我突出显示的“batik ”库包含:

enter image description here

Android&Desktop 模块中使用的“Main”模块中有一些代码:

    String parser = XMLResourceDescriptor.getXMLParserClassName();
SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(parser);

以下代码用于获取SVG文档的宽高,但调用SAXSVGDocumentFactory的构造函数仅在Android上抛出异常。 Desktop 版本没有问题,运行没有任何问题:

03-17 18:23:46.928: ERROR/AndroidRuntime(1517): FATAL EXCEPTION: GLThread 17
java.lang.NoClassDefFoundError: org.apache.batik.dom.svg.SVGDOMImplementation
at org.apache.batik.dom.svg.SAXSVGDocumentFactory.<init>(SAXSVGDocumentFactory.java:111)
at com.revicostudio.gra.GraRenderer.getDocumentWidthAndHeight(GraRenderer.java:103)
at com.revicostudio.gra.GraRenderer.renderSvgToTexture(GraRenderer.java:66)
at com.revicostudio.gra.GraRenderer.render(GraRenderer.java:59)
at com.revicostudio.gra.GraScreen.render(GraScreen.java:31)
at com.badlogic.gdx.Game.render(Game.java:46)
at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:499)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1462)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1216)

Logcat 中也有很多消息由 dalvik 发送并与 org.apache.batik.dom.* 类相关,据我所知,这些消息包含在 batik-svg-dom.jar 中:

03-17 20:26:37.688: INFO/dalvikvm(3632): Failed resolving Lorg/apache/batik/dom/ExtensibleDOMImplementation; interface 5043 'Lorg/w3c/dom/css/DOMImplementationCSS;'
03-17 20:26:37.688: WARN/dalvikvm(3632): Link of class 'Lorg/apache/batik/dom/ExtensibleDOMImplementation;' failed
03-17 20:26:37.688: WARN/dalvikvm(3632): Unable to resolve superclass of Lorg/apache/batik/dom/svg/SVGDOMImplementation; (2490)
03-17 20:26:37.688: WARN/dalvikvm(3632): Link of class 'Lorg/apache/batik/dom/svg/SVGDOMImplementation;' failed
03-17 20:26:37.688: INFO/dalvikvm(3632): Could not find method org.apache.batik.dom.svg.SVGDOMImplementation.getDOMImplementation, referenced from method org.apache.batik.dom.svg.SAXSVGDocumentFactory.<init>
03-17 20:26:37.688: WARN/dalvikvm(3632): VFY: unable to resolve static method 21646: Lorg/apache/batik/dom/svg/SVGDOMImplementation;.getDOMImplementation ()Lorg/w3c/dom/DOMImplementation;
03-17 20:26:37.688: DEBUG/dalvikvm(3632): VFY: replacing opcode 0x71 at 0x0000
03-17 20:26:37.688: INFO/dalvikvm(3632): Failed resolving Lorg/apache/batik/dom/ExtensibleDOMImplementation; interface 5043 'Lorg/w3c/dom/css/DOMImplementationCSS;'
03-17 20:26:37.688: WARN/dalvikvm(3632): Link of class 'Lorg/apache/batik/dom/ExtensibleDOMImplementation;' failed
03-17 20:26:37.688: WARN/dalvikvm(3632): Unable to resolve superclass of Lorg/apache/batik/dom/svg/SVGDOMImplementation; (2490)
03-17 20:26:37.688: WARN/dalvikvm(3632): Link of class 'Lorg/apache/batik/dom/svg/SVGDOMImplementation;' failed
03-17 20:26:37.688: INFO/dalvikvm(3632): Could not find method org.apache.batik.dom.svg.SVGDOMImplementation.getDOMImplementation, referenced from method org.apache.batik.dom.svg.SAXSVGDocumentFactory.<init>
03-17 20:26:37.688: WARN/dalvikvm(3632): VFY: unable to resolve static method 21646: Lorg/apache/batik/dom/svg/SVGDOMImplementation;.getDOMImplementation ()Lorg/w3c/dom/DOMImplementation;
03-17 20:26:37.688: DEBUG/dalvikvm(3632): VFY: replacing opcode 0x71 at 0x0000
03-17 20:26:37.698: INFO/dalvikvm(3632): Failed resolving Lorg/apache/batik/dom/AbstractDocument; interface 5227 'Lorg/w3c/dom/traversal/DocumentTraversal;'
03-17 20:26:37.698: WARN/dalvikvm(3632): Link of class 'Lorg/apache/batik/dom/AbstractDocument;' failed
03-17 20:26:37.698: WARN/dalvikvm(3632): Unable to resolve superclass of Lorg/apache/batik/dom/AbstractStylableDocument; (2467)
03-17 20:26:37.698: WARN/dalvikvm(3632): Link of class 'Lorg/apache/batik/dom/AbstractStylableDocument;' failed
03-17 20:26:37.698: WARN/dalvikvm(3632): Unable to resolve superclass of Lorg/apache/batik/dom/svg/SVGOMDocument; (2485)
03-17 20:26:37.698: WARN/dalvikvm(3632): Link of class 'Lorg/apache/batik/dom/svg/SVGOMDocument;' failed
03-17 20:26:37.698: ERROR/dalvikvm(3632): Could not find class 'org.apache.batik.dom.svg.SVGOMDocument', referenced from method org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument
03-17 20:26:37.698: WARN/dalvikvm(3632): VFY: unable to resolve check-cast 2746 (Lorg/apache/batik/dom/svg/SVGOMDocument;) in Lorg/apache/batik/dom/svg/SAXSVGDocumentFactory;
03-17 20:26:37.698: DEBUG/dalvikvm(3632): VFY: replacing opcode 0x1f at 0x0062
03-17 20:26:37.698: INFO/dalvikvm(3632): Failed resolving Lorg/apache/batik/dom/AbstractDocument; interface 5227 'Lorg/w3c/dom/traversal/DocumentTraversal;'
03-17 20:26:37.698: WARN/dalvikvm(3632): Link of class 'Lorg/apache/batik/dom/AbstractDocument;' failed
03-17 20:26:37.698: WARN/dalvikvm(3632): Unable to resolve superclass of Lorg/apache/batik/dom/AbstractStylableDocument; (2467)
03-17 20:26:37.698: WARN/dalvikvm(3632): Link of class 'Lorg/apache/batik/dom/AbstractStylableDocument;' failed
03-17 20:26:37.698: WARN/dalvikvm(3632): Unable to resolve superclass of Lorg/apache/batik/dom/svg/SVGOMDocument; (2485)
03-17 20:26:37.698: WARN/dalvikvm(3632): Link of class 'Lorg/apache/batik/dom/svg/SVGOMDocument;' failed
03-17 20:26:37.698: ERROR/dalvikvm(3632): Could not find class 'org.apache.batik.dom.svg.SVGOMDocument', referenced from method org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument
03-17 20:26:37.698: WARN/dalvikvm(3632): VFY: unable to resolve check-cast 2746 (Lorg/apache/batik/dom/svg/SVGOMDocument;) in Lorg/apache/batik/dom/svg/SAXSVGDocumentFactory;
03-17 20:26:37.698: DEBUG/dalvikvm(3632): VFY: replacing opcode 0x1f at 0x0013
03-17 20:26:37.698: INFO/dalvikvm(3632): Failed resolving Lorg/apache/batik/dom/AbstractDocument; interface 5227 'Lorg/w3c/dom/traversal/DocumentTraversal;'
03-17 20:26:37.698: WARN/dalvikvm(3632): Link of class 'Lorg/apache/batik/dom/AbstractDocument;' failed
03-17 20:26:37.698: ERROR/dalvikvm(3632): Could not find class 'org.apache.batik.dom.AbstractDocument', referenced from method org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument
03-17 20:26:37.698: WARN/dalvikvm(3632): VFY: unable to resolve check-cast 2467 (Lorg/apache/batik/dom/AbstractDocument;) in Lorg/apache/batik/dom/svg/SAXSVGDocumentFactory;
03-17 20:26:37.698: DEBUG/dalvikvm(3632): VFY: replacing opcode 0x1f at 0x001f
03-17 20:26:37.698: INFO/dalvikvm(3632): Failed resolving Lorg/apache/batik/dom/AbstractDocument; interface 5227 'Lorg/w3c/dom/traversal/DocumentTraversal;'
03-17 20:26:37.698: WARN/dalvikvm(3632): Link of class 'Lorg/apache/batik/dom/AbstractDocument;' failed
03-17 20:26:37.698: WARN/dalvikvm(3632): Unable to resolve superclass of Lorg/apache/batik/dom/AbstractStylableDocument; (2467)
03-17 20:26:37.698: WARN/dalvikvm(3632): Link of class 'Lorg/apache/batik/dom/AbstractStylableDocument;' failed
03-17 20:26:37.698: WARN/dalvikvm(3632): Unable to resolve superclass of Lorg/apache/batik/dom/svg/SVGOMDocument; (2485)
03-17 20:26:37.698: WARN/dalvikvm(3632): Link of class 'Lorg/apache/batik/dom/svg/SVGOMDocument;' failed
03-17 20:26:37.698: ERROR/dalvikvm(3632): Could not find class 'org.apache.batik.dom.svg.SVGOMDocument', referenced from method org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument
03-17 20:26:37.698: WARN/dalvikvm(3632): VFY: unable to resolve check-cast 2746 (Lorg/apache/batik/dom/svg/SVGOMDocument;) in Lorg/apache/batik/dom/svg/SAXSVGDocumentFactory;
03-17 20:26:37.698: DEBUG/dalvikvm(3632): VFY: replacing opcode 0x1f at 0x0013
03-17 20:26:37.698: INFO/dalvikvm(3632): Failed resolving Lorg/apache/batik/dom/AbstractDocument; interface 5227 'Lorg/w3c/dom/traversal/DocumentTraversal;'
03-17 20:26:37.698: WARN/dalvikvm(3632): Link of class 'Lorg/apache/batik/dom/AbstractDocument;' failed
03-17 20:26:37.698: ERROR/dalvikvm(3632): Could not find class 'org.apache.batik.dom.AbstractDocument', referenced from method org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument
03-17 20:26:37.698: WARN/dalvikvm(3632): VFY: unable to resolve check-cast 2467 (Lorg/apache/batik/dom/AbstractDocument;) in Lorg/apache/batik/dom/svg/SAXSVGDocumentFactory;
03-17 20:26:37.698: DEBUG/dalvikvm(3632): VFY: replacing opcode 0x1f at 0x001f
03-17 20:26:37.698: INFO/dalvikvm(3632): Failed resolving Lorg/apache/batik/dom/ExtensibleDOMImplementation; interface 5043 'Lorg/w3c/dom/css/DOMImplementationCSS;'
03-17 20:26:37.698: WARN/dalvikvm(3632): Link of class 'Lorg/apache/batik/dom/ExtensibleDOMImplementation;' failed
03-17 20:26:37.698: WARN/dalvikvm(3632): Unable to resolve superclass of Lorg/apache/batik/dom/svg/SVGDOMImplementation; (2490)
03-17 20:26:37.698: WARN/dalvikvm(3632): Link of class 'Lorg/apache/batik/dom/svg/SVGDOMImplementation;' failed
03-17 20:26:37.698: INFO/dalvikvm(3632): Could not find method org.apache.batik.dom.svg.SVGDOMImplementation.getDOMImplementation, referenced from method org.apache.batik.dom.svg.SAXSVGDocumentFactory.getDOMImplementation
03-17 20:26:37.698: WARN/dalvikvm(3632): VFY: unable to resolve static method 21646: Lorg/apache/batik/dom/svg/SVGDOMImplementation;.getDOMImplementation ()Lorg/w3c/dom/DOMImplementation;
03-17 20:26:37.698: DEBUG/dalvikvm(3632): VFY: replacing opcode 0x71 at 0x0018
03-17 20:26:37.698: INFO/dalvikvm(3632): Failed resolving Lorg/apache/batik/dom/ExtensibleDOMImplementation; interface 5043 'Lorg/w3c/dom/css/DOMImplementationCSS;'
03-17 20:26:37.698: WARN/dalvikvm(3632): Link of class 'Lorg/apache/batik/dom/ExtensibleDOMImplementation;' failed
03-17 20:26:37.698: WARN/dalvikvm(3632): Unable to resolve superclass of Lorg/apache/batik/dom/svg/SVGDOMImplementation; (2490)
03-17 20:26:37.698: WARN/dalvikvm(3632): Link of class 'Lorg/apache/batik/dom/svg/SVGDOMImplementation;' failed
03-17 20:26:37.698: WARN/dalvikvm(3632): Unable to resolve superclass of Lorg/apache/batik/dom/svg12/SVG12DOMImplementation; (2676)
03-17 20:26:37.698: WARN/dalvikvm(3632): Link of class 'Lorg/apache/batik/dom/svg12/SVG12DOMImplementation;' failed
03-17 20:26:37.698: INFO/dalvikvm(3632): Could not find method org.apache.batik.dom.svg12.SVG12DOMImplementation.getDOMImplementation, referenced from method org.apache.batik.dom.svg.SAXSVGDocumentFactory.getDOMImplementation
03-17 20:26:37.698: WARN/dalvikvm(3632): VFY: unable to resolve static method 23668: Lorg/apache/batik/dom/svg12/SVG12DOMImplementation;.getDOMImplementation ()Lorg/w3c/dom/DOMImplementation;
03-17 20:26:37.698: DEBUG/dalvikvm(3632): VFY: replacing opcode 0x71 at 0x0025
03-17 20:26:37.728: WARN/dalvikvm(3632): threadid=10: thread exiting with uncaught exception (group=0x313c61f8)

还有make上有很多warnings: enter image description here

是什么导致了这个问题?

最佳答案

Batik 使用 Java2D API,这在 Android 上不可用。您需要使用另一个库。

关于java.lang.NoClassDefFoundError : org. apache.batik.dom.svg.SVGDOMImplementation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22463600/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com