Clone wiki

android / Building the JavaFX Android Runtime

If you want to build the JavaFX Android runtime from scratch, this is the place to start. Note that you don't have to build the runtime yourself! If you prefer to download the JavaFX Android runtime, you can find it here.

In case you want to hack on the Runtime, you have to use the following instructions.

The JavaFX Android runtime can be created using the sources contained in this repository (https://bitbucket.org/javafxports/android-graphics-rt)

There are a few requirements before you can build the runtime:

  • You need the Android SDK. You can download this here.
  • You need the Android NDK. You can download this here.
  • You need to build the Freetype fonts for Android. Instructions are here.

Once the requirements are met, building the runtime is straightforward. You have to set a few parameters, and then use the gradle build file in the root directory of the sources in order to build the runtime. The required parameters are

  • JAVA_HOME: the root folder of your Java 7 installation
  • JDK_HOME: the root folder of your JDK 1.7 installation
  • JAVA8_HOME: the root folder of a *recent* Java 8 installation (b114 is reported to work)
  • ANDROID_SDK: the location of the Android SDK you downloaded
  • ANDROID_NDK: the location of the Android NDK you downloaded
  • BINARY_STUB: this should point to a Java 8 jfxrt.jar. Mind the confusion, this is really a Java 8 jar!
  • FREETYPE_DIR: this should point to the Freetype installation dir for Android, which you created following the instructions here.

You can now build the runtime as follows (make sure to change the parameters to fit your local settings)

JAVA_HOME=/opt/jdk1.7.0
JDK_HOME=/opt/jdk1.7.0
JAVA8_HOME=/opt/jdk1.8.0
gradle -PANDROID_SDK=/opt/android-sdk -PANDROID_NDK=/opt/android-ndk-r9b -PDEBUG -PDALVIK_VM=true -PBINARY_STUB=/opt/jdk1.8.0/jre/lib/jfxrt.jar -PFREETYPE_DIR=/home/johan/android/porting/freetype/code/freetype-2.5.0/install -PCOMPILE_TARGETS=dalvik

An example build script is provided in build-android.sh

Updated