tbeernot
tbeernot

Reputation: 2612

Gluon app won't start on iOS

And Google is not really helpful.

Mar 20, 2016 9:00:13 AM com.gluonhq.charm.down.common.PlatformFactory getPlatform
SEVERE: null
Throwable occurred: java.lang.ClassNotFoundException: com.gluonhq.charm.down.ios.IOSPlatform
    at java.lang.VMClassLoader.findClassInClasspathForLoader(Native Method)
    at java.lang.PathClassLoader.findClass(PathClassLoader.java)
    at java.lang.ClassLoader.loadClass(ClassLoader.java)
    at java.lang.ClassLoader.loadClass(ClassLoader.java)
    at java.lang.Class.classForName(Native Method)
QuantumRenderer: shutdown
    at java.lang.Class.forName(Class.java)
    at java.lang.Class.forName(Class.java)
    at com.gluonhq.charm.down.common.PlatformFactory.getPlatform(PlatformFactory.java)
    at com.gluonhq.charm.glisten.application.MobileApplication.start(SourceFile)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java)
    at com.sun.javafx.application.LauncherImpl$$Lambda$9.run(Unknown Source)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java)
    at com.sun.javafx.application.PlatformImpl$$Lambda$7.run(Unknown Source)
    at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java)
    at com.sun.javafx.application.PlatformImpl$$Lambda$19.run(Unknown Source)
    at java.security.AccessController.doPrivileged(AccessController.java)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java)
    at com.sun.javafx.application.PlatformImpl$$Lambda$6.run(Unknown Source)
    at org.robovm.apple.uikit.UIApplication.main(Native Method)
    at org.robovm.apple.uikit.UIApplication.main(UIApplication.java)
    at org.javafxports.jfxmobile.ios.BasicLauncher.main(BasicLauncher.java)

Exception in Application start method

java.lang.RuntimeException: Exception in Application start method

    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java)
    at com.sun.javafx.application.LauncherImpl$$Lambda$2.run(Unknown Source)
    at java.lang.Thread.run(Thread.java)
Caused by: java.lang.NullPointerException
    at com.gluonhq.charm.glisten.application.MobileApplication.start(SourceFile)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java)
    at com.sun.javafx.application.LauncherImpl$$Lambda$9.run(Unknown Source)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java)
    at com.sun.javafx.application.PlatformImpl$$Lambda$7.run(Unknown Source)
    at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java)
    at com.sun.javafx.application.PlatformImpl$$Lambda$19.run(Unknown Source)

    at java.security.AccessController.doPrivileged(AccessController.java)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java)
    at com.sun.javafx.application.PlatformImpl$$Lambda$6.run(Unknown Source)
    at org.robovm.apple.uikit.UIApplication.main(Native Method)
    at org.robovm.apple.uikit.UIApplication.main(UIApplication.java)
    at org.javafxports.jfxmobile.ios.BasicLauncher.main(BasicLauncher.java)

This is the build.gradle file:

buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
        jcenter()
        maven { url "https://plugins.gradle.org/m2/" }
    }
    dependencies {
        classpath 'net.linguica.gradle:maven-settings-plugin:0.5'
        classpath 'org.javafxports:jfxmobile-plugin:1.0.7'
    }
}

plugins {
  id "net.linguica.maven-settings" version "0.5" // make maven settings.xml available in gradle (and automatically setup the security settings for the repos based on the grable name vs maven id
}

apply plugin: 'org.javafxports.jfxmobile'

configurations {
    provided
}

repositories {
    mavenLocal()
    mavenCentral()
    maven { url 'http://oss.sonatype.org/content/groups/public/' }
    jcenter() 
    maven { url 'http://nexus.gluonhq.com/nexus/content/repositories/releases/' }
}

sourceSets {
    main {
        compileClasspath += configurations.provided
    }
}

dependencies {
    compile ('nl.knowledgeplaza:DH2RIAShared:1.55-SNAPSHOT') {
        exclude module: 'hessian'
    }
    compile 'blog.monkeyboy:hessian-android:1.0'

    compile 'org.jfxtras:jfxtras-controls:8.0-r5-SNAPSHOT'
    compile 'com.miglayout:miglayout-javafx:5.1-SNAPSHOT'
    compile 'de.jensd:fontawesomefx:8.9-retrolambda'

    compile 'joda-time:joda-time:2.9.2'

    compile 'com.gluonhq:charm:2.1.0'
    androidRuntime 'com.gluonhq:charm-android:2.1.0'
    iosRuntime 'com.gluonhq:charm-ios:2.1.0'
    desktopRuntime 'com.gluonhq:charm-desktop:2.1.0'
}

mainClassName = 'nl.softworks.dh2.dh2fx.DH2FX'

retrolambda {
    defaultMethods true
}

jfxmobile {
    android {
        manifest = 'src/android/AndroidManifest.xml'
        packagingOptions {
           pickFirst  'roboto/Apache License.txt'
        }
        dexOptions {
            javaMaxHeapSize = '1024m'
        }
    }
    ios {
        infoPList = file('src/ios/Default-Info.plist')
    }
}

Upvotes: 0

Views: 750

Answers (1)

José Pereda
José Pereda

Reputation: 45456

When deploying on iOS, you need to use the forceLinkClasses command, so RoboVM can link in the classes contained in those packages during compilation.

You will need to include the classes on your package, and those on any third dependency you may use:

jfxmobile {
    ios {
        forceLinkClasses = [ 'nl.softwork.**.*', 
                             'com.gluonhq.**.*', 
                             'org.jfxtras.**.*',
                             ...  ]
        infoPList = file('src/ios/Default-Info.plist')
   }
}

Upvotes: 1

Related Questions