Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
284 views
in Technique[技术] by (71.8m points)

java - Empty bin,libs,src folders after creating Android project using Javafx android-tools

After creating an Android project using Javafx android-tools, the folders bin, libs, and src were empty! I followed this tutorial: android / Building and deploying JavaFX Applications.

Have I missed something? Please help!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I think that tutorial is quite old... Now you can just use the last plugin they have realeased.

Go to Getting Started site, and check you have everything in place. Basically, 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 or your IDE (optional)
  • And the plugin which is a 'build.gradle' file.

build.gradle:

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'
        androidSdk = file ('<your path to android sdk>')
    }
}

You can try the Ensemble 8 project that you can download from here or clone the project, and see for yourself how easy it is to port this application to Android.

You can create the apk as easy as typing on command line:

gradlew android

or this to create the apk and install it on your android device if you have it connected:

gradlew androidInstall

Once you have tested it, you will want to create your own project. So now you can create new projects with the Gradle plugin. Assuming you use NetBeans, you can create first a root project, and then add an empty subproject. On this subproject you can add all your JavaFX sources and you should override the default gradle.build file with the one shown above, adapting the path to your packages.

You will need the gradlew files and folder from the ensemble project, or if you have gradle on your path, then you can build the apk with the same commands, but using gradle android.

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, and you can report any problem you may have.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...