Run JavaFX app with external libraries in Android? -


i developed javafx application use rxtx library serial communication , in future use bluecove bluetooth. understanding there ways run javafx app on android devices, began research.

the first option running "jar" packaged app android app "java manager". problem here wouldn't know external libraries, since there isn't standard jvm on android devices place them. found project "http://v-lad.org/projects/gnu.io.android/", seems it's oriented android applications.

so when found "http://javafxports.org/", tried make first steps it. project seems need, i'm newbie in android , find documentation little bit confusing, i'm not sure start. moreover, i'm still not sure use java libraries in android approach.

does know if pretend doable?? in case, steps should follow??

you can try javafxports plugin. it's in continuos development, recent versions mature enough use without problems.

have @ basic requirements started here. need jdk8u40+, gradle 2.2+, android sdk , android build tools.

once have ready, can try samples.

also suggest have @ gluon-plugin netbeans. create new empty javafx project you, , able build , deploy on desktop, on android , on ios platforms.

have @ build.gradle file:

buildscript {     repositories {         jcenter()     }     dependencies {         classpath 'org.javafxports:jfxmobile-plugin:1.0.0-b4'     } }  apply plugin: 'org.javafxports.jfxmobile'  repositories {     jcenter() }  mainclassname = 'org.test.javafxports.testjavafx'  jfxmobile {     ios {         forcelinkclasses = [ 'org.test.javafxports.**.*' ]     } } 

first of all, need update plugin version. check here last one: 1.0.0-b8.

build , run on desktop, or run tasks androidinstall generate apk , deploy on android mobile.

once have tested it, , working properly, can start adding code of project.

and question, yes, can add third party jar project.

basically need add dependency on gradle file. can use compile or runtime local files or external repositories:

buildscript {     repositories {         jcenter()     }     dependencies {         classpath 'org.javafxports:jfxmobile-plugin:1.0.0-b8'     } }  apply plugin: 'org.javafxports.jfxmobile'  repositories {     jcenter() }  dependencies {     compile files('lib/<your local jar>.jar')     compile 'org.glassfish:javax.json:1.0.4'     androidcompile 'org.glassfish:javax.json:1.0.4' }  mainclassname = 'org.test.javafxports.testjavafx'  jfxmobile {     ios {         forcelinkclasses = [ 'org.test.javafxports.**.*' ]     } } 

note can add dependencies added 1 single platform, androidcompile or androidruntime.

since apk run on dalvik vm, java 7 features allowed. can use lambdas, though, since plugin uses retrolambda project internally on code. aware not applied on added jars.

as example of using jars on project, can use gluon-charm-down open source library, provides access native services on device, local storage or gps.

dependencies {     compile 'com.gluonhq:charm-down-common:0.0.1'     androidruntime 'com.gluonhq:charm-down-android:0.0.1'     desktopruntime 'com.gluonhq:charm-down-desktop:0.0.1' } 

in fact, jfxmobile plugin , library, 2048fx game has been ported android (google play) , ios (apple store).


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -