在Android应用中使用Gluon Mobile时不断获取NullPointerException

时间:2019-06-26 08:04:11

标签: gluon gluon-mobile

当我在Android设备上运行它时,我的应用程序中出现以下异常。 我可以忽略它,因为它被记录为警告吗?

2019-06-26 13:24:49.942  W/System.err: java.lang.reflect.InvocationTargetException
2019-06-26 13:24:49.942  W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2019-06-26 13:24:49.942  W/System.err:     at javafxports.android.FXDalvikEntity.onGlobalLayout(FXDalvikEntity.java:389)
2019-06-26 13:24:49.943  W/System.err:     at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:945)
2019-06-26 13:24:49.943  W/System.err:     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2351)
2019-06-26 13:24:49.943  W/System.err:     at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1465)
2019-06-26 13:24:49.943  W/System.err:     at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7288)
2019-06-26 13:24:49.943  W/System.err:     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:979)
2019-06-26 13:24:49.943  W/System.err:     at android.view.Choreographer.doCallbacks(Choreographer.java:791)
2019-06-26 13:24:49.944  W/System.err:     at android.view.Choreographer.doFrame(Choreographer.java:726)
2019-06-26 13:24:49.944  W/System.err:     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:965)
2019-06-26 13:24:49.944  W/System.err:     at android.os.Handler.handleCallback(Handler.java:790)
2019-06-26 13:24:49.944  W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:99)
2019-06-26 13:24:49.944  W/System.err:     at android.os.Looper.loop(Looper.java:164)
2019-06-26 13:24:49.944  W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6687)
2019-06-26 13:24:49.947  W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2019-06-26 13:24:49.947  W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
2019-06-26 13:24:49.947  W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:810)
2019-06-26 13:24:49.948  W/System.err: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'double javafx.scene.Scene.getHeight()' on a null object reference
2019-06-26 13:24:49.948  W/System.err:     at com.sun.javafx.scene.control.skin.TextFieldSkinAndroid.adjustSize(TextFieldSkinAndroid.java:111)
2019-06-26 13:24:49.948  W/System.err:     at com.sun.javafx.scene.control.skin.TextFieldSkinAndroid.lambda$showSoftwareKeyboard$643(TextFieldSkinAndroid.java:107)
2019-06-26 13:24:49.948  W/System.err:     at com.sun.javafx.scene.control.skin.TextFieldSkinAndroid.access$lambda$2(Unknown Source:4)
2019-06-26 13:24:49.948  W/System.err:     at com.sun.javafx.scene.control.skin.TextFieldSkinAndroid$$Lambda$3.accept(Unknown Source:8)
2019-06-26 13:24:49.948  W/System.err:     at com.sun.glass.ui.android.DalvikInput.keyboardSize(DalvikInput.java:72)

这是我的build.gradle文件,带有用于不同paltforms的本机Log服务。我正在使用Java 1.8和Gradle-5.1.1 我观察到的是,当我尝试使用PictureService或StorageService时会打印此异常,但我不确定。

buildscript {
    repositories {
        jcenter()
        google()
        maven {
            url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
        }
    }
    dependencies {
        classpath 'org.javafxports:jfxmobile-plugin:1.3.16'        
    }
}

apply plugin: 'org.javafxports.jfxmobile'
apply from: 'ios-build.gradle'

repositories {
    jcenter()
    maven {
        url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
    }
}

mainClassName = '<MAIN CLASS>'

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    compile 'com.gluonhq:charm:5.0.2'
    compile 'com.gluonhq:glisten-afterburner:1.4.1'
    compile 'com.jfoenix:jfoenix:8.0.8'
    // Remove after development
    compile 'com.github.javafaker:javafaker:0.18'
    // Desktop SQL -> https://github.com/xerial/sqlite-jdbc
    desktopRuntime 'org.xerial:sqlite-jdbc:3.8.11.2'

    // Embedded SQL -> https://github.com/xerial/sqlite-jdbc
    embeddedRuntime 'org.xerial:sqlite-jdbc:3.7.2'

    // Android SQL -> https://github.com/SQLDroid/SQLDroid
    androidRuntime 'org.sqldroid:sqldroid:1.0.3'

    // ios SQL -> https://github.com/robovm/robovm 1.8
}

jfxmobile {
    downConfig {
        version = '3.8.6'
        // Do not edit the line below. Use Gluon Mobile Settings in your project context menu instead
        plugins 'browser', 'dialer', 'display', 'lifecycle', 'local-notifications', 'pictures', 'position', 'push-notifications', 'runtime-args', 'settings', 'statusbar', 'storage', 'vibration'
    }
    android {
        manifest = 'src/android/AndroidManifest.xml'
        compileSdkVersion = 28
        minSdkVersion = 15
        dexOptions {
            javaMaxHeapSize '3g'
        }
        packagingOptions {
            exclude 'META-INF/LICENSE.txt'
            exclude 'META-INF/NOTICE.txt'
        }
    }
    ios {
        infoPList = file('src/ios/Default-Info.plist')
        forceLinkClasses = [                
                'com.gluonhq.**.*',
                'javax.annotations.**.*',
                'javax.inject.**.*',
                'javax.json.**.*',
                'org.glassfish.json.**.*',
                'SQLite.**.*'
        ]
    }
}

task xcodebuild {
    doLast {
        xcodebuildIOS("$project.buildDir","$project.projectDir", "Log")
    }
}

task installNativeLib (type:Copy, dependsOn: xcodebuild) {
    from("$project.buildDir/native")
    into("src/ios/jniLibs")
    include("*.a")
}

0 个答案:

没有答案