我已經安裝了構建工具25.0.3,沒有在所有的build.gradle
文件膠子插件生成一個單一視圖項目的任何修改:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.8'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
mainClassName = 'com.gluonandroid24.GluonAndroid24'
dependencies {
compile 'com.gluonhq:charm:4.3.7'
}
jfxmobile {
downConfig {
version = '3.6.0'
// Do not edit the line below. Use Gluon Mobile Settings in your project context menu instead
plugins 'display', 'lifecycle', 'statusbar', 'storage'
}
android {
manifest = 'src/android/AndroidManifest.xml'
}
ios {
infoPList = file('src/ios/Default-Info.plist')
forceLinkClasses = [
'com.gluonhq.**.*',
'javax.annotations.**.*',
'javax.inject.**.*',
'javax.json.**.*',
'org.glassfish.json.**.*'
]
}
}
我可以包括Java的8流:
public BasicView(String name) {
super(name);
Label label = new Label("Hello JavaFX World!");
Button button = new Button("Change the World!");
button.setGraphic(new Icon(MaterialDesignIcon.LANGUAGE));
button.setOnAction(e -> label.setText("Sum: " + Stream.of("1", "2", "5")
.mapToInt(Integer::parseInt)
.sum()));
VBox controls = new VBox(15.0, label, button);
controls.setAlignment(Pos.CENTER);
controls.getChildren().stream()
.filter(Label.class::isInstance)
.forEach(System.out::println);
setCenter(controls);
}
並在桌面上運行該項目,並在Android上成功運行它(至少在我的設備上使用Android 7.1.1)。顯然不是在iOS上。
jfxmobile插件已經尋找您安裝在$ AndroidSdk/build-tools中的最新生成工具版本。如果你想設置一些選項,你可以設置:
jfxmobile {
...
android {
manifest = 'src/android/AndroidManifest.xml'
buildToolsVersion = '25.0.3'
compileSdkVersion = '25'
minSdkVersion = '25'
targetSdkVersion = '25'
}
}
我明白了,謝謝。順便說一句,gluon plugin和eclipse(帶Buildship)有一個問題,它不會讓你完成新的項目嚮導。有人發佈它[這裏](https://stackoverflow.com/questions/42953287/eclipse-gluon-new-project-does-not-finish)所以如果問題是膠子方面,也許你應該報告它。 – Mark
謝謝,這是一個已知的問題:新的Buildship 2+打破了Buildship 1.0。+的兼容性,這是與插件捆綁在一起的。它已經被報道。現在的解決方案是回到Buildship 1。 –