After creating an Android project using Javafx android-tools, the folders bin, libs, and src were empty! I followed this tutorial: android / Building and deploying JavaFX Applications.
Have I missed something? Please help!
After creating an Android project using Javafx android-tools, the folders bin, libs, and src were empty! I followed this tutorial: android / Building and deploying JavaFX Applications.
Have I missed something? Please help!
I think that tutorial is quite old... Now you can just use the last plugin they have realeased.
Go to Getting Started site, and check you have everything in place. Basically, you will need:
build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:javafxmobile-plugin:1.0.0-rc3'
}
}
apply plugin: 'javafxmobile'
mainClassName='org.javafxports.android.MainJavaFX'
repositories {
jcenter()
}
jfxmobile {
android {
applicationPackage = 'org.javafxports.android'
androidSdk = file ('<your path to android sdk>')
}
}
You can try the Ensemble 8 project that you can download from here or clone the project, and see for yourself how easy it is to port this application to Android.
You can create the apk as easy as typing on command line:
gradlew android
or this to create the apk and install it on your android device if you have it connected:
gradlew androidInstall
Once you have tested it, you will want to create your own project. So now you can create new projects with the Gradle plugin. Assuming you use NetBeans, you can create first a root project, and then add an empty subproject. On this subproject you can add all your JavaFX sources and you should override the default gradle.build file with the one shown above, adapting the path to your packages.
You will need the gradlew files and folder from the ensemble project, or if you have gradle on your path, then you can build the apk with the same commands, but using gradle android
.
Important considerations
The plugin works with the last JDK8 8u40, but it doesn't support all Java 8 features (Streams and Optional), while it supports Lambdas. On the contrary, it supports mainly all the JavaFX 8 features.
It's in working progress, so some issues may not been solved yet, and you can report any problem you may have.