0

i have a JavaFX application and i am trying to make it run on iOS it is running well in Android. Linux, Mac. but I just get a white screen on the iOS-simulator

i am not using java-modules.

i got this exception in the terminal

Exception in Application start method
[Thu Sept 15 14:43:27 CEST 2022][INFO] [SUB] Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
[Thu Sept 15 14:43:27 CEST 2022][INFO] [SUB]    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:901)
[Thu Sept 15 14:43:27 CEST 2022][INFO] [SUB]    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
[Thu Sept 15 14:43:27 CEST 2022][INFO] [SUB]    at java.lang.Thread.run(Thread.java:833)
[Thu Sept 15 14:43:27 CEST 2022][INFO] [SUB]    at com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:704)
[Thu Sept 15 14:43:27 CEST 2022][INFO] [SUB]    at com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:202)
[Thu Sept 15 14:43:27 CEST 2022][INFO] [SUB] Caused by: java.lang.UnsatisfiedLinkError: no webview in java.library.path
[Thu Sept 15 14:43:27 CEST 2022][INFO] [SUB]    at com.oracle.svm.core.jdk.NativeLibrarySupport.loadLibraryRelative(NativeLibrarySupport.java:132)
[Thu Sept 15 14:43:27 CEST 2022][INFO] [SUB]    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:47)
[Thu Sept 15 14:43:27 CEST 2022][INFO] [SUB]    at java.lang.Runtime.loadLibrary0(Runtime.java:818)
[Thu Sept 15 14:43:27 CEST 2022][INFO] [SUB]    at java.lang.System.loadLibrary(System.java:1989)
[Thu Sept 15 14:43:27 CEST 2022][INFO] [SUB]    at javafx.scene.web.WebView.<clinit>(WebView.java:112)

About the pom.xml (which is already ran well in Android)


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.xxxx.xxxx</groupId>
    <artifactId>xxxxxxxx</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <maven.compiler.release>11</maven.compiler.release>

        <javafx.version>19</javafx.version>
        <attach.version>4.0.15</attach.version>
        <gluonfx.plugin.version>1.0.15</gluonfx.plugin.version>
        <javafx.plugin.version>0.0.8</javafx.plugin.version>
        <mainClassName>com.xxx.xxxx.xxxxx.AppxxxxmainClassName>

    </properties>
    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>${javafx.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-web</artifactId>
            <version>${javafx.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>${javafx.version}</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>display</artifactId>
            <version>${attach.version}</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>lifecycle</artifactId>
            <version>${attach.version}</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>statusbar</artifactId>
            <version>${attach.version}</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>storage</artifactId>
            <version>${attach.version}</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>util</artifactId>
            <version>${attach.version}</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>keyboard</artifactId>
            <version>${attach.version}</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <release>11</release>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>${javafx.plugin.version}</version>
                <executions>
                    <execution>
                        <!-- Default configuration for running -->
                        <!-- Usage: mvn clean javafx:run -->
                        <id>default-cli</id>
                        <configuration>
                            <mainClass>${mainClassName}</mainClass>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.gluonhq</groupId>
                <artifactId>gluonfx-maven-plugin</artifactId>
                <version>${gluonfx.plugin.version}</version>
                <configuration>
                    <target>${gluonfx.target}</target>
                    <verbose>true</verbose>
                    <attachList>
                        <list>display</list>
                        <list>lifecycle</list>
                        <list>statusbar</list>
                        <list>keyboard</list>
                        <list>storage</list>
                    </attachList>
                    <reflectionList>
                        <list>com.xxx.xxx.xxxxxx.xxxxxxxxx</list>
                    </reflectionList>
                    <mainClass>${mainClassName}</mainClass>
                    <releaseConfiguration>
                        <bundleName>xxxx</bundleName>
                    </releaseConfiguration>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>ios</id>
            <properties>
                <gluonfx.target>ios</gluonfx.target>
            </properties>
        </profile>
        <profile>
            <id>android</id>
            <properties>
                <gluonfx.target>android</gluonfx.target>
            </properties>
        </profile>
        <profile>
            <id>ios-sim</id>
            <properties>
                <gluonfx.target>ios-sim</gluonfx.target>
            </properties>
        </profile>
    </profiles>
</project>


Also, I tried

  • Java 11 & 17
  • GraalVM 11 & 17
  • javaFX 18 & 19
  • iOS Simulator & Real Device

i am using this mvn command

 mvn -Pios-sim clean gluonfx:runagent gluonfx:build gluonfx:package gluonfx:install gluonfx:nativerun

All gave same results,

SamFX
  • 19
  • 6
  • May this help, This is the beginning of graalvm logs ‘ [GVM] Starting GVM for ios ..determineCpuFeaures ..Sept 15, 2022 2:43:27 PM com.sun.javafx.application.PlatformImpl startup ..WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @4563e9ab' ..IOSWindowSystemInterface : share 0 view 0 pf otready ..GL_VERSION string = OpenGL ES 2.0 APPLE-19.4.3 .. initialize() returns 140517253880896 ..IOSWindowSystemInterface : share 32ad5c0 view 0 pf otready ..GL_VERSION (major.minor) = 0.0 ‘ – SamFX Sep 15 '22 at 13:05
  • Check the logs under `target/gluonfx`, and see if the `libjfxwebkit.a` is added to the link command? – José Pereda Sep 15 '22 at 13:18
  • no but i found this -force_load,/Users/xxxx/.gluon/substrate/javafxStaticSdk/19-ea+8/ios-arm64/sdk/lib/libwebview.a – SamFX Sep 15 '22 at 13:25
  • Right, that is because for iOS there is no WebKit, the JavaFX WebView just uses the native one. You say you tested a real device, do you have the same issue? Also, did you test on macOS, the exact same project? – José Pereda Sep 15 '22 at 14:17
  • yes, mac os is is working fine. when i do runagent it run in the mac peacfully. in the real device, yes i have the same problem, but in the real device i can not read the logss, but i can when i do in simulator – SamFX Sep 15 '22 at 14:21
  • On macOS, also `mvn gluonfx:build gluonfx:nativerun` should work. On the iOS simulator, I can reproduce your issue. But on iOS device it works fine for me. Since you can't see the logs, it could be for a different reason. – José Pereda Sep 15 '22 at 14:37
  • I see the issue: `~/.gluon/substrate/javafxStaticSdk/19-ea+8/ios-arm64/sdk/lib/libwebview.a` is linked only for arm64, not for x86_64, while the rest of the other libraries are for both. I've just filed an [issue](https://github.com/gluonhq/substrate/issues/1171). – José Pereda Sep 15 '22 at 14:59
  • Nice, so we found a bug here, which is good. now i am trying to check how it is working in the real devices. Is there is a way to receive the exceptions, logs, why it is not working like android and in the terminal i receive the logs. or do i made something wrong ?? – SamFX Sep 15 '22 at 17:38
  • If you deploy to your plugged device, when you run `mvn -Píos gluonfx:nativerun` you should be able to get all the logs in your terminal and under the log folder. – José Pereda Sep 15 '22 at 19:25
  • The terminals stop give any updates, but the logs shows that there is an error behind that "[fopen failed for data file: errno = 2 (No such file or directory)]". – SamFX Sep 16 '22 at 05:21
  • But this error is not appear on the mac nativerun. on mac nativerun i have a different error in the JS-Bridging !! i feel blue. – SamFX Sep 16 '22 at 05:23
  • Also i want to tell you important note about the iOS installation, the installions as listed in the gluonfx docs is not running as expected. i had to install "brew install ios-deploy" first, Please if this is true (i think) we may need to update gluonfx doc for that beside installing (libusbmuxd & libimobiledevice) to avoid problems for next users – SamFX Sep 16 '22 at 05:26
  • 1
    I see, that is relevant, as GluonFX applies a [patch](https://github.com/gluonhq/substrate/blob/master/src/main/java/com/gluonhq/substrate/util/ios/Deploy.java#L317) when installing `iOS-deploy`, precisely to enable receiving the logs from the terminal. That's why the docs don't ask to install it. – José Pereda Sep 16 '22 at 08:52
  • I see, also from this patch code I see the errors that I had because the patch couldn’t install it by itself , that’s why I installed it . I will uninstall it and I will try again. Thanks man, – SamFX Sep 16 '22 at 13:53
  • 1
    FYI, if you use GluonFX 1.0.16-SNAPSHOT, the WebView should work now on your iOS Simulator. Just make sure you add a `pluginRepository` to your pom with this URL: `http://oss.sonatype.org/content/repositories/snapshots`. – José Pereda Sep 22 '22 at 08:57
  • FYI: just feedback. it worked smoothly :) – SamFX Sep 23 '22 at 04:57

0 Answers0