使用Gluon-mobile和Java9的iOS上的MultiView FXML Project [英] MultiView FXML Project on iOS using Gluon-mobile and Java9

查看:81
本文介绍了使用Gluon-mobile和Java9的iOS上的MultiView FXML Project的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建一个全新的MultiView FXML项目,然后在Gradle中添加Java9必需品:

Creating a completely new MultiView FXML Project and then adding the Java9 necessities in Gradle:

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'    
}

导致 [SUB]线程"JavaFX Application Thread"中的异常java.lang.IllegalStateException:必须先显示舞台,然后才能显示对话框.

完整的控制台日志

该项目可以在桌面和Android上正常运行,但不能在iOS模拟器和设备上运行.我已经尝试了很多事情,但是由于这个错误是在新创建的项目中发生的,因此我相信这是由gluon-mobile和Java9的相互作用引起的.

The project runs as expected on Desktop and Android, but not on iOS simulator and device. 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.

奖金:仅将 jfxmobile-plugin 更改为2.0.18甚至无法编译:

Bonus: Changing only the jfxmobile-plugin to 2.0.18 fails even compiling with:

[15:08:15:141] com.gluonhq.higgs.Higgs:仍在编译... 8823 剩下的课程.
[15:08:25:143] com.gluonhq.higgs.Higgs:仍然 正在编译...还剩4152个课程.
[15:08:34:389] com.gluonhq.higgs.Compiler:第0轮中途完成 java.lang.StackOverflowError
在java.base/java.util.HashMap.putVal(HashMap.java:642)
在java.base/java.util.HashMap.put(HashMap.java:612)
在java.base/java.util.HashSet.add(HashSet.java:220)
在com.gluonhq.higgs.DependencyGraph.visitReachableNodes(DependencyGraph.java:170)

[15:08:15:141] com.gluonhq.higgs.Higgs: Still compiling... 8823 classes left.
[15:08:25:143] com.gluonhq.higgs.Higgs: Still compiling... 4152 classes left.
[15:08:34:389] com.gluonhq.higgs.Compiler: halfway done round 0 java.lang.StackOverflowError
at java.base/java.util.HashMap.putVal(HashMap.java:642)
at java.base/java.util.HashMap.put(HashMap.java:612)
at java.base/java.util.HashSet.add(HashSet.java:220)
at com.gluonhq.higgs.DependencyGraph.visitReachableNodes(DependencyGraph.java:170)

推荐答案

这些步骤对我有用:

  • 使用Java 9和带有Gluon IDE插件2.6.2的NetBeans 9(测试版),我创建了一个Gluon项目(带有FXML的多视图).当然,这也将与其他IDE一起使用.

  • 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). Of course, this will work with other IDEs as well.

我检查了gradle包装器是否使用4.3.1(或更高版本).

I've checked that the gradle wrapper was using 4.3.1 (or superior).

我已经修改了build.gradle文件,以在jfxmobile 2.0.18中使用Gluon VM:

I've modified the build.gradle file to use Gluon VM with jfxmobile 2.0.18:

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'
    }
}

并更新了依赖项:

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'
}

  • 然后我将项目部署到我的iOS设备,没有任何问题.
  • 请注意,清理~/.gvm缓存可能很方便,因为它可能包含较旧版本的不再使用的类.当然,您还应该清理项目./gradle/build文件夹.

    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. Of course, you should also clean your project ./gradle and /build folders.

    这篇关于使用Gluon-mobile和Java9的iOS上的MultiView FXML Project的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆