借助jfxmobile-plugin可以轻松实现
请参考:http://docs.gluonhq.com/javafxports/
前提:Android平台需要设置ANDROID_HOME环境变量
在build.gradle设置如下构建脚本:
buildscript {
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.10'
}
}
apply plugin: 'org.javafxports.jfxmobile'
mainClassName = 'com.xxx.Main'
jfxmobile {
ios {
forceLinkClasses = ['com.xxx.xxx.**.*']
}
android {
applicationPackage = 'com.xxx.xxx'
}
}
然后, 通过运行 ./gradlew android 命令编译成APK (debug)