buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.1.1'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
maven {
url 'https://mvnrepository.com/artifact/com.caucho/hessian'
}
maven {
url'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
mainClassName = 'com.demoapp.DemoApp'
dependencies {
compile 'com.gluonhq:charm:4.1.0'
compile 'com.airhacks:afterburner.mfx:1.6.2'
compile 'com.caucho:hessian:4.0.7'
compile 'com.google.code.gson:gson:2.3.1'
compile 'org.apache.poi:poi:3.9'
}
jfxmobile {
downConfig {
version '3.0.0'
plugins 'display', 'lifecycle', 'statusbar', 'storage'
}
android {
manifest = 'src/android/AndroidManifest.xml'
}
ios {
infoPList = file('src/ios/Default-Info.plist')
forceLinkClasses = [
'com.demoapp.**.*',
'com.gluonhq.**.*',
'io.datafx.**.*',
'javax.annotations.**.*',
'javax.inject.**.*',
'javax.json.**.*',
'org.glassfish.json.**.*',
'com.caucho.**.*',
'com.google.code.gson.**.*',
'org.apache.poi.**.*'
]
}
}
Error Exception in Application init method QuantumRenderer: shutdown java.lang.RuntimeException: Exception in Application init method at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:109069952) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$156(LauncherImpl.java:109069952) at com.sun.javafx.application.LauncherImpl$$Lambda$2.run(Unknown Source) at java.lang.Thread.run(Thread.java:109069952) Caused by: java.lang.NoSuchMethodError: com.demoapp.DemoApp$$Lambda$1.()V at com.demoapp.DemoApp.init(DemoApp.java:109070784) at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:109070784) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$156(LauncherImpl.java:109070784) at com.sun.javafx.application.LauncherImpl$$Lambda$2.run(Unknown Source) at java.lang.Thread.run(Thread.java:109070784)
Any idea where to search for the init-Error when deploying..? Thanks.
Init:
@Override
public void init() {
NavigationDrawer drawer = new NavigationDrawer();
NavigationDrawer.Header header = new NavigationDrawer.Header("demo inc", "smart teamwork", new Avatar(21, new Image(DemoApp.class.getResourceAsStream("/icon.png"))));
drawer.setHeader(header);
drawer.getItems().addAll(primaryItem, secondaryItem, thirdItem);
primaryItem.setSelected(true);
addViewFactory(PRIMARY_VIEW, () -> (View) new PrimaryView().getView());
addViewFactory(SECONDARY_VIEW, () -> (View) new SecondaryView().getView());
addViewFactory(THIRD_VIEW, () -> (View) new ThirdView().getView());
addLayerFactory(MENU_LAYER, () -> new SidePopupView(drawer));
}
@Override
public void postInit(Scene scene) {
Swatch.ORANGE.assignTo(scene);
scene.getStylesheets().add(DemoApp.class.getResource("style.css").toExternalForm());
((Stage) scene.getWindow()).getIcons().add(new Image(DemoApp.class.getResourceAsStream("/icon.png")));
switchView(SECONDARY_VIEW);
}
The exception shows that a lambda expression is failing. Probably those in your init
method with the view suppliers.
Possible reasons for this exception are:
Retrolambda
The jfxmobile plugin since version 1.1.0 applies retrolambda to all the dependencies. But you can't apply it twice.
The first step will be checking which dependencies might use retrolambda.
Charm 4+ doesn't use it. Afterburner 1.6.2 does, so either you change it to:
dependencies {
compileNoRetrolambda 'com.airhacks:afterburner.mfx:1.6.2'
}
or you use the brand new version that excludes it:
dependencies {
compile 'com.airhacks:afterburner.mfx:1.6.3'
}
To make sure none of the other dependencies use it, replace compile
with compileNoRetrolambda
in hessian, gson and poi.
Cache
Also, when updating projects with lower versions of the jfxmobile plugin, it is possible that you have a previous build on your cache. This might contain classes that you compiled with retrolambda.
While the code is the same, Gradle will skip compiling them again, but when the retrolambda plugin is applied again over them, this will fail.
To avoid this problem, an easy solution is using clean
before building and deploying your project: Run ./gradlew clean launchIOSDevice
.