javaandroidjavafxjavafxports

JavaFX on android - Hello world keeps crashing


So I read that you can get JavaFX applications to run on Android by using the Dalvik JavaFX-Android SDK (provided by the JavaFX Android porting team) and decided to try my hand at it.

After installing the Dalvik SDK and telling it where my Android SDK is, I tried to run the sample Hello World application that comes with the Dalvik SDK. So I went into the Hello World app's folder and ran the "gradlew installdebug" command. It all went well:


(source: forumbilder.se)

But when I tried launching the application on my phone it did not go so well:


(source: forumbilder.se)

Is there anyone of you that could provide an answer or maybe some speculation as to why it won't run?

Error message from Logcat:


(source: forumbilder.se)


Solution

  • (While the problem is already solved and the application is working, this is the solution, in case anyone faces the same problem)

    Once android-sdk is installed, and once you download the dalvik package (dalvik-sdk-8u40-ea3 or new releases), to create the apk for the samples in that package, it's required to update a file named local.properties for each sample.

    This file should contain the path to android sdk and to dalvik-sdk.

    Then, from command line gradlew installDebug will create the apk and install it on the device.

    Also, it comes in handy logging the messages from the device, not only in case the app crashes but also in case of unexpected behavior, or to check any System.out.println().

    For that, from < android-sdk path >/platform-utils running on the command line

    adb shell logcat
    

    will log the app (and others from the device).