我使用了针对Gluon魅力的浏览器服务。但它不起作用。有人可以帮帮我吗?我没有任何错误。那是我的Build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.1'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
mainClassName = 'com.gluonapplication.GluonApplication'
dependencies {
compile 'com.gluonhq:charm:4.2.0'
androidRuntime 'org.sqldroid:sqldroid:1.0.3'
androidCompile 'org.glassfish:javax.json:1.0.4'
androidRuntime 'com.google.zxing:core:3.2.1'
compile group: 'org.xerial', name: 'sqlite-jdbc', version: '3.15.1'
compile group: 'org.sqldroid', name: 'sqldroid', version: '1.0.3'
compile group: 'com.gluonhq', name: 'charm-down-desktop', version: '0.0.2'
compile group: 'com.gluonhq', name: 'charm-down-common', version: '0.0.1'
compile group: 'com.gluonhq', name: 'charm-down-android', version: '0.0.1'
compileNoRetrolambda 'com.airhacks:afterburner.mfx:1.6.2'
compile group: 'com.gluonhq', name: 'charm-down-plugin-browser', version: '3.2.0'
compile group: 'com.gluonhq', name: 'charm-down-plugin-barcode-scan-android', version: '3.2.0'
compile group: 'com.gluonhq', name: 'charm-down-plugin-battery', version: '3.2.0'
compile group: 'com.gluonhq', name: 'charm-down-plugin-dialer-android', version: '3.2.0'
compile group: 'com.gluonhq', name: 'charm-down-plugin-pictures', version: '3.2.0'
compile group: 'com.gluonhq', name: 'charm-down-plugin-position', version: '3.2.0'
}
jfxmobile {
downConfig {
version = '3.1.0'
plugins 'cache','display', 'lifecycle', 'statusbar', 'storage'
}
android {
manifest = 'src/android/AndroidManifest.xml'
applicationPackage = 'org.javafxports.ensemble'
}
ios {
infoPList = file('src/ios/Default-Info.plist')
forceLinkClasses = [
'com.gluonapplication.**.*',
'com.gluonhq.**.*',
'javax.annotations.**.*',
'javax.inject.**.*',
'javax.json.**.*',
'org.glassfish.json.**.*',
'ensemble.**.*'
]
}
}
我已经实现了这样的服务
public void browser() {
Services.get(BrowserService.class).ifPresent(service -> {
try {
service.launchExternalBrowser("www.google.com");
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
});
}
在我将它添加到场景生成器的按钮
之后位置和条形码扫描插件也不能正常工作 以下是我实施它的方法。
public void position() {
Services.get(PositionService.class).ifPresent(service -> {
Position position = service.getPosition();
System.out.printf("Current position: %.5f, %.5f", position.getLatitude(), position.getLongitude());
LS4.setText(position.getLatitude() + " /" + position.getLongitude() + "");
});
}
public void barCode() {
Services.get(BarcodeScanService.class).ifPresent(service -> {
BarcodeScanService barcodeScanService = (BarcodeScanService) new BarcodeScanServiceFactory();
Optional<String> barcode = barcodeScanService.scan();
barcode.ifPresent(barcodeValue -> LS4.setText(barcodeValue));
});
}
那是我的androidmanifest
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.gluonapplication" android:versionCode="1" android:versionName="1.0">
<supports-screens android:xlargeScreens="true"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="21"/>
<application android:label="MultiViewProjectFXML" android:name="android.support.multidex.MultiDexApplication" android:icon="@mipmap/ic_launcher">
<activity android:name="javafxports.android.FXActivity" android:labe
L =&#34; MultiViewProjectFXML&#34;机器人:configChanges =&#34;取向|屏幕尺寸&#34;&GT;
答案 0 :(得分:0)
您的构建包含错误的依赖项,插件应由downConfig
配置管理。
它将负责添加适当的插件和适当的平台。
修改您的依赖项和插件,如下所示:
dependencies {
compile 'com.gluonhq:charm:4.3.0'
androidRuntime 'org.sqldroid:sqldroid:1.0.3'
androidCompile 'org.glassfish:javax.json:1.0.4'
androidRuntime 'com.google.zxing:core:3.2.1'
desktopCompile group: 'org.xerial', name: 'sqlite-jdbc', version: '3.15.1'
desktopCompile group: 'org.sqldroid', name: 'sqldroid', version: '1.0.3'
compile 'com.airhacks:afterburner.mfx:1.6.3'
}
jfxmobile {
downConfig {
version = '3.2.0'
plugins 'barcode-scan', 'battery', 'browser', 'cache', 'dialer', 'display', 'lifecycle', 'picture', 'position', 'statusbar', 'storage'
}
}
对于浏览器服务,您需要包含http://
。