【问题标题】:import JavaFX project on Android Studio [closed]在 Android Studio 上导入 JavaFX 项目 [关闭]
【发布时间】:2015-04-09 17:54:10
【问题描述】:

我在 Eclipse 上制作了一个运行良好的 JavaFX 程序,现在我想将此程序转换为 android 应用程序。我将 Gradle 与 eclipse 一起使用,我得到了一个文件“build.gradle”,所以我通过像 eclipse 所说的那样导入“build.gradle”来在 Android Studio 上导入这个项目。但现在我不知道如何将我的 JavaFX 程序转换为 Android 应用程序,也不知道如何使用 Android Studio。有人可以帮助我吗?

这是我在 Android Studio 上的项目结构:

--Puzzle_FX
  --.idea
    --copyright
        profiles_settings.xml
    --scopes
        scope_settings.xml
    .name
    compiler.xml
    encodings.xml
    gradle.xml
    misc.xml
    modules.xml
    vcs.xml
    workspace.xml
  --.settings
      org.eclipse.jdt.core.prefs
  --bin
    --org
      --puzzle
        --colors
            CColors.class
        --commands
            commands.txt
            SmartInput.class
        --controllers
            Controller.class
        --fonts
            apple.ttf
            bit.ttf
            pixelmix.ttf
            pixelmix_bold.ttf
            wendy.ttf
        --frames
            Console.class
            CreateFrames.class
            ShowGame.class
        --models
            Cel.class
            CelExtended.class
            Game.class
            Grid.class
        --nodes
            GCanevasFX.class
            GCelFX.class
            GPolygonFX.class
            GShadowFX.class
        --styles
            style.css
        --texts
            Input.class
            Output.class
            pixelmix.ttf
        --views
            Overview.fxml
            RootLayout.fxml
      MainApp.class
  --doc
    ...
      documentation
    ...
  --gradle
    --wrapper
        gradle-wrapper.jar
        gradle-wrapper.properties
  --src
    ...
      all my .java file
    ...
  .classpath
  .project
  build.gradle
  gradlew
  gradlew.bat
  local.properties
  Puzzle_FX.iml
--External Libraries

这是我在eclipse上使用gradle时得到的

【问题讨论】:

标签: android eclipse android-studio javafx javafxports


【解决方案1】:

如果您想在不使用 Android Studio 的情况下将 JavaFX 项目转换为 Android 并保留 JavaFX 源代码,那么您应该查看JavaFXPorts 项目。

您只需在 build.gradle 中包含一个插件。

查看此处提供的链接JavaFXPorts。

您也可以通过一个用例查看此博客post。

即使您使用的是 Eclipse,您也可以考虑为 NetBeans 使用 Gluon 的 plugin,这将为您创建一个 JavaFX 项目,您可以在其中添加源代码,甚至拥有 Android 原生服务。

请记住,Android 运行 Dalvik VM,因此您不能使用 Java 8 的新功能(流)。

【讨论】:

  • 感谢您的建议我会看这个,但我无法使用 Android Studio 将我的 javafx 项目转换为 android 应用程序?
  • 好吧,您提到您不知道如何使用它...在samples 存储库中有一个项目(Kokos)是在Android Studio 中完成的,所以这是可能的。但是有了 jfxmobile 插件,您就不需要它了……您可以从您的 IDE 构建 apk。
  • 所以使用 JFXPorts 我可以使用 jfxmobile 插件并从 eclipse 构建我的 apk 吗?
  • 是的,当然。我建议使用 NetBeans,因为 Gluon 插件会为您创建一个新项目,但您可以从上述示例中检查项目。如果您不需要任何本机服务,请查看 HelloWorld。如果你这样做了,那么看看 HelloPlatform。
  • 好的,谢谢!我会看 JFXPorts 和 Gluon,你的博客也很简单,你做得很好:)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-12-13
  • 2020-01-10
  • 2013-09-01
  • 2014-01-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多