我的一位同事试图在他的机器上构建我的JavaFXPorts应用程序。好处是:在对forceLinkClasses
文件中的build.gradle
部分进行一些小的更新后,它才有效。
但...
虽然我们可以短暂地看到其中一张白色Default*.png
图像,但我们面对的是黑屏大约5秒钟。
在控制台上,他可以看到以下输出(其中包括):
[WARN] java.lang.Class: Class.forName() failed to load 'ch.cnlab.disentis.resource.strings_en'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>ch.cnlab.disentis.resource.strings_en</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'ch.cnlab.disentis.resource.strings_de_CH'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>ch.cnlab.disentis.resource.strings_de_CH</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'ch.cnlab.disentis.resource.strings_de'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>ch.cnlab.disentis.resource.strings_de</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'ch.cnlab.disentis.resource.strings'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>ch.cnlab.disentis.resource.strings</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'com.fasterxml.jackson.databind.ext.Java7SupportImpl'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>com.fasterxml.jackson.databind.ext.Java7SupportImpl</pattern></forceLinkClasses> to your robovm.xml file to link it in.
Nov 4, 2016 11:32:44 AM com.fasterxml.jackson.databind.ext.Java7Support <clinit>
WARNING: Unable to load JDK7 types (annotations, java.nio.file.Path): no Java7 support added
[WARN] java.lang.Class: Class.forName() failed to load 'javax.xml.stream.FactoryFinder$ClassLoaderFinderConcrete'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>javax.xml.stream.FactoryFinder$ClassLoaderFinderConcrete</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'javax.xml.stream.FactoryFinder$ClassLoaderFinderConcrete'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>javax.xml.stream.FactoryFinder$ClassLoaderFinderConcrete</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'javax.xml.stream.FactoryFinder$ClassLoaderFinderConcrete'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>javax.xml.stream.FactoryFinder$ClassLoaderFinderConcrete</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'javax.xml.stream.FactoryFinder$ClassLoaderFinderConcrete'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>javax.xml.stream.FactoryFinder$ClassLoaderFinderConcrete</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'com.sun.javafx.font.t2k.T2KFactory'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>com.sun.javafx.font.t2k.T2KFactory</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'com.sun.javafx.tk.quantum.QuantumMessagesBundle_de_CH'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>com.sun.javafx.tk.quantum.QuantumMessagesBundle_de_CH</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'com.sun.javafx.tk.quantum.QuantumMessagesBundle_de'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>com.sun.javafx.tk.quantum.QuantumMessagesBundle_de</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'com.sun.javafx.tk.quantum.QuantumMessagesBundle'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>com.sun.javafx.tk.quantum.QuantumMessagesBundle</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'com.oracle.jrockit.jfr.FlightRecorder'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>com.oracle.jrockit.jfr.FlightRecorder</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'com.sun.javafx.scene.control.skin.resources.controls_de_CH'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>com.sun.javafx.scene.control.skin.resources.controls_de_CH</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'com.sun.javafx.scene.control.skin.resources.controls_de'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>com.sun.javafx.scene.control.skin.resources.controls_de</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'com.sun.javafx.scene.control.skin.resources.controls'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>com.sun.javafx.scene.control.skin.resources.controls</pattern></forceLinkClasses> to your robovm.xml file to link it in.
setSwapInterval(1)
max rectangle texture cell size = 89
wrap rectangle texture = 2 x 2
ES2ResourceFactory: Prism - createStockShader: AlphaTexture_Color.frag
ES2ResourceFactory: Prism - createStockShader: FillRoundRect_Color.frag
ES2ResourceFactory: Prism - createStockShader: DrawRoundRect_Color.frag
ES2ResourceFactory: Prism - createStockShader: Texture_Color.frag
ES2ResourceFactory: Prism - createStockShader: Solid_TextureRGB.frag
Loading Prism common native library ...
succeeded.
setSwapInterval(0)
setSwapInterval(1)
setSwapInterval(0)
setSwapInterval(1)
setSwapInterval(0)
setSwapInterval(1)
setSwapInterval(0)
延迟似乎发生在RoboVM警告之后。
有没有人知道,原因可能是什么?
谢谢和问候, 丹尼尔
PS:我需要问这个,因为他在StackOverflow上没有账号......所以如果我需要让他再次测试,可能会有一些往返时间。答案 0 :(得分:1)
通常在几秒钟内出现黑屏意味着启动时会有一些重负荷。
在继续之前,请确保加载是严格必要的,并检查在后台任务上执行此操作是否解决了问题。
如果这没有帮助,有几个选项可以避免长黑屏:
一,使用JavaFX 预加载器。创建从Preloader
扩展的预加载器类,并提供轻量级场景(即图像)。在build.gradle脚本中添加preloaderClassName = 'full.preloader.class.name'
。
当重载结束时(这应该在init
方法中完成),将加载应用程序,并且您可以隐藏预加载器阶段。
使用Gluon Mobile(Charm 4.0.1),使用轻量级 Home View ,加载速度足够快,并开始在后台加载那些繁重的任务。用户必须使用一些导航按钮或导航抽屉切换到辅助视图,但黑屏(如果有)将更短。
最后使用 Splash View (已包含在Charm 4+中),它将允许短时间显示图像或某个标签,同时可执行任务以加载这些重组件。在那之后,飞溅 可以被解雇,主页视图将被加载。
尝试其中任何一种解决方案,并检查问题是否消失。
答案 1 :(得分:0)
感谢@JoséPereda,我们发现了问题:这是用于测试的iPhone。这是一款经常用于开发的旧款手机。显然,它处于“近乎死亡”状态。
在我们切换到另一部手机(另一位同事的iPhone 6S :-D)之后,应用程序表现得像预期的那样:在测试期间闪电般快速。