1

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.

Community
  • 1
  • 1
Mark
  • 2,167
  • 4
  • 32
  • 64
  • Try to update downConfig to version = '3.2.3' and see if it works – jns Mar 18 '17 at 02:48
  • @jns The gradle build works (downloaded and runs) with the newer version but the problem wit loca storage service remains. Where di you get that number from? – Mark Mar 18 '17 at 02:59
  • The downConfig version is from [here](https://bitbucket.org/gluon-oss/charm-down). Could you post your main class, i.e. how you access the `StorageService`? – jns Mar 18 '17 at 03:26
  • @jns I don't access it in my main class. I use `Services.get(StorageService.class)` in the class which I I need it. There's nothing related in the main class. Are you looking for something specific? – Mark Mar 18 '17 at 04:02
  • Have you tried if you can access any of the other services like `display` ? – jns Mar 18 '17 at 05:32
  • @jns `Services.get(DisplayService.class)` is also empty. – Mark Mar 18 '17 at 05:50
  • How are you running the app on desktop? From your IDE or with any desktop task? – José Pereda Mar 18 '17 at 09:56
  • Just in case have a look at this [question](http://stackoverflow.com/questions/41035769/compile-and-build-gluon-mobile-app-for-desktop/41041335#41041335) – José Pereda Mar 18 '17 at 12:16
  • @JoséPereda I ran it from the IDE but after reading i found the problem - i was running the wrong task. Now I have permissions issues but will try to resolve these myself first. thanks. – Mark Mar 19 '17 at 00:38
  • All these years later, I can find no resolution to this issue in over 3 hours of googling. – TheGeeko61 Apr 25 '22 at 19:33

0 Answers0