Ethyl Casin
Ethyl Casin

Reputation: 793

Converting Javafx application jar file to apk files (Netbeans)

Is there a facility in netbeans that will automate the conversion of javafx jar file into apk files?

Upvotes: 3

Views: 9733

Answers (2)

José Pereda
José Pereda

Reputation: 45456

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.

Upvotes: 7

Dyrandz Famador
Dyrandz Famador

Reputation: 4525

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

Upvotes: 0

Related Questions