如何在Gluon Project中引用android.jar [英] How to reference android.jar in Gluon Project

查看:73
本文介绍了如何在Gluon Project中引用android.jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上面是我的Gluon项目,用于在Android上部署JavaFX.我的问题是我无法引用android.jar.该如何解决?

Above is my Gluon project to deploy JavaFX on Android. My problem is that I cant reference the android.jar. How to resolve this?

build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'org.javafxports:jfxmobile-plugin:1.0.0-b9'
    }
}

apply plugin: 'org.javafxports.jfxmobile'

repositories {
    jcenter()
}

mainClassName = 'com.raes.Main'

jfxmobile {
    android {
        manifest = 'src/android/AndroidManifest.xml'
    }
    ios {
        infoPList = file('src/ios/Default-Info.plist')
    }
}

推荐答案

使用Gluon创建JavaFX项目时插件,默认情况下会创建四个主要软件包:

When you create a JavaFX project using Gluon plugin for NetBeans, by default four main packages are created:

  • 源程序包[Java]
  • 桌面/Java软件包
  • Android/Java软件包
  • Ios/Java软件包

和四个资源包.

此外,如果您检查依赖关系",则默认情况下,android(android.jar和jfxdvk jar)和iOS(robovm jars)都具有排他性依赖关系.

Also, if you check the Dependencies, by default there are exclusive dependencies for android (android.jar and jfxdvk jar) and for iOS (robovm jars).

这意味着您可以将Java代码放在四个给定范围中的任何一个中,但是可以在定义的范围中使用这些依赖项:您将只能在Android/下添加android依赖项Java程序包.

This means that you can place Java code in any of the four given scopes, but you can use those dependencies only in their defined scope: you will be able to add android dependencies only under Android/Java Packages.

如果您查看JavaFXPorts的 samples 回购下的HelloPlatform,您将看到一种方法处理如何从主应用程序中调用特定于平台的代码.

If you have a look at HelloPlatform under the samples repo of JavaFXPorts, you will see a way of dealing with how to call your platform specific code from the main application.

还请检查此项目,因为它已经包含Android蓝牙依赖项,并查看如何从中调用它们主类,方法是使用PlatformFactory类,如果您在Android设备上运行JavaFX应用程序,则该类会在运行时加载AndroidPlaftorm类.

Also check this project, as it already includes Android Bluetooth dependencies, and see how they are called from the main class, by using a PlatformFactory class that loads on runtime the AndroidPlaftorm class if you are running your JavaFX app on an Android device.

这篇关于如何在Gluon Project中引用android.jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆