How to reference android.jar in Gluon Project

丶灬走出姿态 提交于 2020-02-24 05:15:47

问题


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

回答1:


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

  • Source Packages [Java]
  • Desktop/Java Packages
  • Android/Java Packages
  • Ios/Java Packages

and four resources packages.

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

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.

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.

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.



来源:https://stackoverflow.com/questions/31422098/how-to-reference-android-jar-in-gluon-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!