簡體   English   中英

iOS 的 Gluon 移動 NoClassDefFoundError

[英]Gluon mobile NoClassDefFoundError for iOS

我在 Gluon 中創建了一個 Hello World 示例應用程序,並包含用於測試的 freemarker 庫。 它在桌面版本中運行,但是當我在 iOS 中運行時,在 freemarker 模板加載期間,它拋出了這個錯誤:

[WARN] java.lang.Class: Class.forName() failed to load 'org.apache.log4j.Logger'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>org.apache.log4j.Logger</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'org.apache.log4j.Logger'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>org.apache.log4j.Logger</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'org.apache.log.Logger'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>org.apache.log.Logger</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'freemarker.core._2_4_OrLaterMarker'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>freemarker.core._2_4_OrLaterMarker</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'org.zeroturnaround.javarebel.ClassEventListener'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>org.zeroturnaround.javarebel.ClassEventListener</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'org.python.core.PyObject'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>org.python.core.PyObject</pattern></forceLinkClasses> to your robovm.xml file to link it in.
java.lang.NoClassDefFoundError: javax.swing.tree.TreeNode
    at java.lang.VMClassLoader.findClassInClasspathForLoader(Native Method)
    at java.lang.PathClassLoader.findClass(PathClassLoader.java:193)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:515)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:475)
    at java.lang.VMClassLoader.findClassInClasspathForLoader(Native Method)
    at java.lang.PathClassLoader.findClass(PathClassLoader.java:193)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:515)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:475)
    at freemarker.core.FMParser.Setting(FMParser.java:3604)
    at freemarker.core.FMParser.FreemarkerDirective(FMParser.java:3684)
    at freemarker.core.FMParser.MixedContentElements(FMParser.java:4006)
    at freemarker.core.FMParser.Root(FMParser.java:4652)
    at freemarker.template.Template.<init>(Template.java:252)
    at freemarker.cache.TemplateCache.loadTemplate(TemplateCache.java:549)
    at freemarker.cache.TemplateCache.getTemplateInternal(TemplateCache.java:439)
    at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:292)
    at freemarker.template.Configuration.getTemplate(Configuration.java:2798)
    at freemarker.template.Configuration.getTemplate(Configuration.java:2647)
    at com.gluonapplication.BasicView.test(BasicView.java:86)
    at com.gluonapplication.BasicView$1.handle(BasicView.java:49)
    at com.gluonapplication.BasicView$1.handle(BasicView.java:40)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)

我看到一些帖子提到,需要為 iOS 添加forceLinkClasses ,所以我添加了:

'freemarker.**.*',
'javax.swing.**.*'

它仍然不起作用。

錯誤發生在以下行:

Configuration cfg = new Configuration(Configuration.VERSION_2_3_29);
cfg.setTemplateLoader(new ClassTemplateLoader(Thread.currentThread().getContextClassLoader(), "/"));
cfg.getTemplate("xxx/xxx"); // error here

此代碼完全有效。 我認為TreeNode不包含在 Gluon 中,所以我嘗試了這個:

TreeNode treeNode = null;

這工作正常。 所以TreeNode應該在那里。

任何人都可以請幫助建議是什么問題?

嘗試使用org.freemarker:freemarker-gae而不是org.freemarker:freemarker GAE 變體是相同的,沒有 Swing 依賴項。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM