浏览器服务无法在 android 台设备上运行

Browser Service don't work on android device

我已经使用了 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();
            }
        });
    }

在我将它添加到 Scene Builder 的按钮中之后

Position 和 Barcode-Scan 插件不能正常工作 这是我的实现方式。

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="MultiViewProjectFXML" android:configChanges="orientation|screenSize">

您的构建包含错误的依赖项,插件应由 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://