简体   繁体   English

使用Gluon-mobile和Java9的iOS上的MultiView FXML Project

[英]MultiView FXML Project on iOS using Gluon-mobile and Java9

Creating a completely new MultiView FXML Project and then adding the Java9 necessities in Gradle: 创建一个全新的MultiView FXML项目,然后在Gradle中添加Java9必需品:

buildscript {
    repositories {
        jcenter()
        google()
        maven{
            url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
        }
    }
    dependencies {
        classpath 'org.javafxports:jfxmobile-plugin:2.0.5'
    }
}

...

sourceCompatibility = 1.8
targetCompatibility = 1.8

...

dependencies {
    compile 'com.gluonhq:charm:4.4.0-jdk9'
    androidRuntime 'com.gluonhq:charm:4.4.1'
    compile 'com.airhacks:afterburner.mfx:1.6.3'

    // Added because of javax.annotation.PostConstruct Java9 issues
    compile group: 'javax.xml.ws', name: 'jaxws-api', version: '2.2.6'    
}

leads to [SUB] Exception in thread "JavaFX Application Thread" java.lang.IllegalStateException: Stage must be showing before making the Dialog visible. 导致线程“ JavaFX Application Thread”中的[SUB]异常java.lang.IllegalStateException:在显示对话框之前必须显示阶段。

full console log 完整的控制台日志

The project runs as expected on Desktop and Android, but not on iOS simulator and device. 该项目可以在台式机和Android上正常运行,但不能在iOS模拟器和设备上运行。 I have tried many things, but since this error comes on newly created projects leads me to believe that it's something caused by the interplay of gluon-mobile and Java9. 我已经尝试了很多方法,但是由于这个错误是在新创建的项目中发生的,因此我相信这是由gluon-mobile和Java9的相互作用引起的。

Bonus: Changing only the jfxmobile-plugin to 2.0.18 fails even compiling with: 奖励:仅将jfxmobile-plugin更改为2.0.18甚至无法通过以下命令进行编译:

[15:08:15:141] com.gluonhq.higgs.Higgs: Still compiling... 8823 classes left. [15:08:15:141] com.gluonhq.higgs.Higgs:仍在编译...还剩8823个课程。
[15:08:25:143] com.gluonhq.higgs.Higgs: Still compiling... 4152 classes left. [15:08:25:143] com.gluonhq.higgs.Higgs:仍在编译...还剩4152类。
[15:08:34:389] com.gluonhq.higgs.Compiler: halfway done round 0 java.lang.StackOverflowError [15:08:34:389] com.gluonhq.higgs.Compiler:在0 java.lang.StackOverflowError回合中途完成
at java.base/java.util.HashMap.putVal(HashMap.java:642) 在java.base / java.util.HashMap.putVal(HashMap.java:642)
at java.base/java.util.HashMap.put(HashMap.java:612) 在java.base / java.util.HashMap.put(HashMap.java:612)
at java.base/java.util.HashSet.add(HashSet.java:220) 在java.base / java.util.HashSet.add(HashSet.java:220)
at com.gluonhq.higgs.DependencyGraph.visitReachableNodes(DependencyGraph.java:170) 在com.gluonhq.higgs.DependencyGraph.visitReachableNodes(DependencyGraph.java:170)

These steps work for me: 这些步骤对我有用:

  • Using Java 9, and NetBeans 9 (beta version) with Gluon IDE plugin 2.6.2, I've created a Gluon project (multi view with FXML). 使用Java 9和带有Gluon IDE插件2.6.2的NetBeans 9(测试版),我创建了一个Gluon项目(带有FXML的多视图)。 Of course, this will work with other IDEs as well. 当然,这也将与其他IDE一起使用。

  • I've checked that the gradle wrapper was using 4.3.1 (or superior). 我检查了gradle包装器是否使用4.3.1(或更高版本)。

  • I've modified the build.gradle file to use Gluon VM with jfxmobile 2.0.18: 我修改了build.gradle文件以将build.gradle VM与jfxmobile 2.0.18结合使用:

build.gradle file: build.gradle文件:

buildscript {
    repositories {
        jcenter()
        google()
        maven {
            url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
        }
    }
    dependencies {
        classpath 'org.javafxports:jfxmobile-plugin:2.0.18'
    }
}

and updated the dependencies: 并更新了依赖项:

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    compile 'com.gluonhq:charm:4.4.0-jdk9'
    compile 'com.airhacks:afterburner.mfx:1.6.3'
    compile 'javax.annotation:javax.annotation-api:1.3.2'
    androidRuntime 'com.gluonhq:charm:4.4.1'
}
  • Then I just deployed the project to my iOS device without any issue. 然后,我将项目部署到我的iOS设备,没有任何问题。

Note that it may be convenient to clean your ~/.gvm cache, as it might contain classes from older versions that shouldn't be used anymore. 请注意,清理~/.gvm缓存可能会很方便,因为它可能包含旧版本中的不再使用的类。 Of course, you should also clean your project ./gradle and /build folders. 当然,您还应该清理项目./gradle/build文件夹。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM