【问题标题】:MultiView FXML Project on iOS using Gluon-mobile and Java9使用 Gluon-mobile 和 Java9 在 iOS 上的 MultiView FXML 项目
【发布时间】:2018-03-27 13:25:57
【问题描述】:

创建一个全新的 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'    
}

在线程“JavaFX 应用程序线程”java.lang.IllegalStateException 中导致 [SUB] 异常:在使对话框可见之前必须显示舞台。

full console log

该项目在桌​​面和 Android 上按预期运行,但在 iOS 模拟器和设备上不运行。我尝试了很多东西,但是由于这个错误出现在新创建的项目上,让我相信这是由 gluon-mobile 和 Java9 的相互作用引起的。

奖励:仅将 jfxmobile-plugin 更改为 2.0.18 甚至编译都失败:

[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)

【问题讨论】:

  • 你能用compile 'javax.annotation:javax.annotation-api:1.3.2'代替'jaxws-api'吗?
  • @JoséPereda Same console log
  • 你能再试一次 2.0.18 但使用 Charm Down 版本3.7.2
  • @JoséPereda 它已经设置为3.7.2

标签: ios java-9 gluon-mobile


【解决方案1】:

这些步骤对我有用:

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

  • 我已检查 gradle 包装器使用的是 4.3.1(或更高版本)。

  • 我已修改 build.gradle 文件以将 Gluon VM 与 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文件夹。

【讨论】:

  • 难道我使用的是 Gluon IDE 插件 2.5.3?我在 Eclipse Marketplace 中只看到了这个版本。然而,NetBeans 似乎有 2.6.2 和 IntelliJ 甚至 2.6.3
  • 不,这也是最新版本。一旦你有了一个有效的 build.gradle 文件,插件版本就不再重要了。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-02-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多