I'm able to build, package and run several JavaFX projects on recent Android devices - smartphone, tablet. But when I try to target an old device with a barcode scanner, Android version 6.0.1 API level 23, I end up with a crash when running the app.
To simplify it, I tried the same process with the Gluon sample project 'HelloFX'. These are the plugins versions on an Ubuntu 22.04 machine:
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<artifactId>gluonfx-maven-plugin</artifactId>
<version>1.0.23</version>
Java version is 17.0.3 JavaFX 17 GraalVM 22.1.0.1 Java 17 CE
When I run the app I obtain the following log:
[mer gen 29 15:04:44 CET 2025][INFORMAZIONI] ==================== RUN TASK ====================
[mer gen 29 15:04:45 CET 2025][INFORMAZIONI] [SUB] --------- beginning of main
[mer gen 29 15:04:45 CET 2025][INFORMAZIONI] [SUB] --------- beginning of system
[mer gen 29 15:04:45 CET 2025][INFORMAZIONI] [SUB] V/GraalActivity( 5813): onCreate start, using Android Logging v1
[mer gen 29 15:04:45 CET 2025][INFORMAZIONI] [SUB] V/GraalActivity( 5813): onCreate done
[mer gen 29 15:04:45 CET 2025][INFORMAZIONI] [SUB] V/GraalActivity( 5813): onStart
[mer gen 29 15:04:45 CET 2025][INFORMAZIONI] [SUB] V/GraalActivity( 5813): onStart done
[mer gen 29 15:04:45 CET 2025][INFORMAZIONI] [SUB] V/GraalActivity( 5813): onResume
[mer gen 29 15:04:45 CET 2025][INFORMAZIONI] [SUB] V/GraalActivity( 5813): onResume done
[mer gen 29 15:04:45 CET 2025][INFORMAZIONI] [SUB] V/GraalActivity( 5813): surfaceCreated for com.gluonhq.helloandroid.MainActivity@40a600
[mer gen 29 15:04:45 CET 2025][INFORMAZIONI] [SUB] V/GraalActivity( 5813): loading substrate library
[mer gen 29 15:04:45 CET 2025][INFORMAZIONI] [SUB] --------- beginning of crash
[mer gen 29 15:04:45 CET 2025][INFORMAZIONI] [SUB] E/AndroidRuntime( 5813): FATAL EXCEPTION: main
[mer gen 29 15:04:45 CET 2025][INFORMAZIONI] [SUB] E/AndroidRuntime( 5813): Process: com.gluonhq.samples.hellofx, PID: 5813
[mer gen 29 15:04:45 CET 2025][INFORMAZIONI] [SUB] E/AndroidRuntime( 5813): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "getgrgid_r" referenced by "/data/app/com.gluonhq.samples.hellofx-1/lib/arm64/libsubstrate.so"...
[mer gen 29 15:04:45 CET 2025][INFORMAZIONI] [SUB] E/AndroidRuntime( 5813): at java.lang.Runtime.loadLibrary(Runtime.java:372)
[mer gen 29 15:04:45 CET 2025][INFORMAZIONI] [SUB] E/AndroidRuntime( 5813): at java.lang.System.loadLibrary(System.java:1076)
There is a crash because of the unsatisfied link to function "getgrgid_r". After a research I found out that getgrgid_r was introduced in SDK 24, so I tried to produce a native image for API level 23 - which match the device on hand.
As instructed I copied the generated AndroidManifest.xml in HelloFX/src/android and added the tag <uses-sdk>:
<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="23" />
After several tries, it seems that the Android SDK used to package the app depends by the gluon plugin version, not considering this tag. The build.gradle of the generated project has these lines:
android {
namespace 'com.gluonhq.samples.hellofx'
compileSdkVersion 34
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
defaultConfig {
minSdkVersion 21
targetSdkVersion 34
}
the minSdkVersion=21 would be fine for me, but I can't manage to run the app.
Is there something I am missing?