Similar question but didn't help: JavaFXPorts(Gluon Plugin) Saving Files on Android
I want to access the local storage on desktop and mobile. For now I'm testing on desktop. Whenever i launch the program I get the following in the error stream:
Mar 18, 2017 3:57:47 PM com.gluonhq.charm.down.Platform <clinit>
SEVERE: javafx.platform is not defined. Desktop will be assumed by default.
Mar 18, 2017 3:57:48 PM com.gluonhq.impl.charm.a.c.a <clinit>
SEVERE: null
java.io.IOException: Private storage file not available
at com.gluonhq.impl.charm.a.c.a.c(SourceFile:37)
at java.util.Optional.orElseThrow(Optional.java:290)
at com.gluonhq.impl.charm.a.c.a.<clinit>(SourceFile:37)
at com.gluonhq.charm.glisten.application.MobileApplication.a(SourceFile:244)
at com.gluonhq.charm.glisten.application.MobileApplication.start(SourceFile:211)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)
and Services.get(StorageService.class);
return an empty optional.
The trimmed down gradle build file is
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.2'
}
}
apply plugin: 'org.javafxports.jfxmobile'
apply plugin: 'eclipse'
jfxmobile {
downConfig {
version = '3.0.0'
plugins 'display', 'lifecycle', 'statusbar', 'storage' // <-- storage included by default
}
android {
compileSdkVersion = 23
manifest = 'src/android/AndroidManifest.xml'
}
ios {
infoPList = file('src/ios/Default-Info.plist')
forceLinkClasses = [
'com.gluonhq.**.*',
'javax.annotations.**.*',
'javax.inject.**.*',
'javax.json.**.*',
'org.glassfish.json.**.*'
]
}
}
eclipse {
classpath {
downloadJavadoc = true
downloadSources = true
}
}
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
mainClassName = 'com.foo.MainClass'
dependencies {
compile 'com.gluonhq:charm:4.3.1'
}
task wrapper(type: Wrapper) {
gradleVersion = '3.4'
}
Not sure what this version is
jfxmobile {
downConfig {
version = '3.0.0'
because if I change it to 4.3.1
Gradle gives me an error (can post if relevant).
Also I tried adding to dependencies {
desktopRuntime "com.gluonhq:charm-down-desktop:4.3.1"
like in the linked question but it did nothing.