简体   繁体   中英

Converting Javafx application jar file to apk files (Netbeans)

netbeans中是否有一个工具可以自动将javafx jar文件转换为apk文件?

Actually, there is a way to create an Android application (apk) from a JavaFX application, based on the JavaFXPorts project.

Recently, a new plugin has been released, so you can just 'drop it' on your JavaFX project and build the apk.

Have a look at the 'getting started' guide . Basically, considering you are using NetBeans, you will need:

  • JDK8u40 early access release installed, JAVA_HOME should be set with the JDK path.
  • Gradle 2.2.1 installed
  • Android SDK
  • Android Build Tools 21.1.1 using SDK Manager.
  • Gradle Plugin for NetBeans (optional)
  • And the plugin which is a 'build.gradle' file

It looks like this:

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'
    }
}

I suggest you try the Ensemble 8 project , clone the project, and see for yourself how easy it is to port this application to Android.

You can create new projects with the Gradle plugin, then add a JavaFX project, add the plugin, and it will create the apk as easy as:

gradlew android

Or you can use any existing JavaFX project with this build.gradle file.

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.

It's not possible.

If you want to develop a javafx app on android:

Use the JavaFX-Android SDK to generate an Android project based on your JavaFX Application

see this: http://www.infoq.com/articles/Building-JavaFX-Android-Apps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM