【问题标题】:GluonMobile application hangs when reading position from PositionService从 PositionService 读取位置时,GluonMobile 应用程序挂起
【发布时间】:2022-06-26 02:45:28
【问题描述】:

这是GluonMobile application gives a black screen with PositionService 的延续。从那里使用相同的文件,并进行以下新更改:

public class HomeView extends View {

    private PositionService positionService;
    private Button posButton = new Button("Activate position");

    public HomeView() {
        posButton.setOnAction(e -> positioning());
        setCenter(posButton);
    }

    private void positioning() {
        PositionService.create().ifPresent(service -> {
            positionService = service;
            System.out.println("service created: " + positionService);
            positionService.start();
            System.out.println("service started: " + positionService);
            positionService.stop();
            System.out.println("service stopped: " + positionService);
        });
    }

    @Override
    protected void updateAppBar(AppBar appBar) {
        appBar.setVisible(false);
    }
}

运行并按下按钮。应用程序挂起,按钮处于按下状态。运行adb logcat -v color,这是按下按钮时发生的情况:

03-16 23:19:23.738  1371  2407 D InputReader: Input event(6): value=1 when=4704804257163000
03-16 23:19:23.739  1371  2407 D InputReader: Input event(6): value=1 when=4704804257163000
03-16 23:19:23.739  1371  2407 I InputReader: Touch event's action is 0x0 (deviceType=0) [pCnt=1, s=0.13197 ] when=4704804257163000
03-16 23:19:23.740  1371  2406 I InputDispatcher: Delivering touch to (2667): action: 0x4, toolType: 1
03-16 23:19:23.740  1371  2406 I InputDispatcher: Delivering touch to (21531): action: 0x0, toolType: 1
03-16 23:19:23.743 21531 21531 D ViewRootImpl@233d1ae[MainActivity]: ViewPostIme pointer 0
03-16 23:19:23.745 21531 21531 V GraalActivity: Activity, get touch event, pcount = 1
03-16 23:19:23.745 21531 21531 E GraalGluon: Native Dalvik layer got touch event, pass to native Graal layer...
03-16 23:19:23.745 21531 21531 I GLASS   : Call InternalSurfaceView_onMultiTouchEventNative
03-16 23:19:23.745 21531 21531 E GraalGluon: Native Dalvik layer got touch event, passed to native Graal layer...
03-16 23:19:23.745   724   724 D SEC LightsHAL: button : 1 +
03-16 23:19:23.746 21531 21550 D GraalCompiled: traceEvent: Pushing TouchState[1,TouchState.Point[id=0,x=218,y=297]] to TouchPipeline[SmallMove]
03-16 23:19:23.746 21531 21550 D GraalCompiled: traceEvent: Applying SmallMove to TouchState[1,TouchState.Point[id=0,x=218,y=297]]
03-16 23:19:23.746 21531 21550 D GraalCompiled: traceEvent: Set TouchState[1,TouchState.Point[id=0,x=218,y=297]]
03-16 23:19:23.747 21531 21550 D GraalCompiled: traceEvent: Set MouseState[x=218,y=297,wheel=0,buttonsPressed=IntSet[212]]
03-16 23:19:23.763 21531 21531 V GraalActivity: Activity, get touch event, pcount = 1
03-16 23:19:23.763 21531 21531 E GraalGluon: Native Dalvik layer got touch event, pass to native Graal layer...
03-16 23:19:23.763 21531 21531 I GLASS   : Call InternalSurfaceView_onMultiTouchEventNative
03-16 23:19:23.764 21531 21531 E GraalGluon: Native Dalvik layer got touch event, passed to native Graal layer...
03-16 23:19:23.764 21531 21550 D GraalCompiled: traceEvent: Pushing TouchState[1,TouchState.Point[id=0,x=218,y=297]] to TouchPipeline[SmallMove]
03-16 23:19:23.764 21531 21550 D GraalCompiled: traceEvent: Applying SmallMove to TouchState[1,TouchState.Point[id=0,x=218,y=297]]
03-16 23:19:23.766 21531 21550 D GraalCompiled: traceEvent: Set TouchState[1,TouchState.Point[id=0,x=218,y=297]]
03-16 23:19:23.770   724   724 D SEC LightsHAL: button : 1 -
03-16 23:19:23.782 21531 21531 V GraalActivity: Activity, get touch event, pcount = 1
03-16 23:19:23.782 21531 21531 E GraalGluon: Native Dalvik layer got touch event, pass to native Graal layer...
03-16 23:19:23.782 21531 21531 I GLASS   : Call InternalSurfaceView_onMultiTouchEventNative
03-16 23:19:23.783 21531 21531 E GraalGluon: Native Dalvik layer got touch event, passed to native Graal layer...
03-16 23:19:23.783 21531 21550 D GraalCompiled: traceEvent: Pushing TouchState[1,TouchState.Point[id=0,x=218,y=296]] to TouchPipeline[SmallMove]
03-16 23:19:23.783 21531 21550 D GraalCompiled: traceEvent: Applying SmallMove to TouchState[1,TouchState.Point[id=0,x=218,y=296]]
03-16 23:19:23.783 21531 21550 D GraalCompiled: traceEvent: Set TouchState[1,TouchState.Point[id=0,x=218,y=296]]
03-16 23:19:23.783 21531 21550 D GraalCompiled: traceEvent: Set MouseState[x=218,y=296,wheel=0,buttonsPressed=IntSet[212]]
03-16 23:19:23.799 21531 21531 V GraalActivity: Activity, get touch event, pcount = 1
03-16 23:19:23.799 21531 21531 E GraalGluon: Native Dalvik layer got touch event, pass to native Graal layer...
03-16 23:19:23.799 21531 21531 I GLASS   : Call InternalSurfaceView_onMultiTouchEventNative
03-16 23:19:23.799 21531 21531 E GraalGluon: Native Dalvik layer got touch event, passed to native Graal layer...
03-16 23:19:23.803 21531 21550 D GraalCompiled: traceEvent: Pushing TouchState[1,TouchState.Point[id=0,x=218,y=296]] to TouchPipeline[SmallMove]
03-16 23:19:23.803 21531 21550 D GraalCompiled: traceEvent: Applying SmallMove to TouchState[1,TouchState.Point[id=0,x=218,y=296]]
03-16 23:19:23.803 21531 21550 D GraalCompiled: traceEvent: Set TouchState[1,TouchState.Point[id=0,x=218,y=296]]
03-16 23:19:23.833 21531 21531 V GraalActivity: Activity, get touch event, pcount = 1
03-16 23:19:23.833 21531 21531 E GraalGluon: Native Dalvik layer got touch event, pass to native Graal layer...
03-16 23:19:23.833 21531 21531 I GLASS   : Call InternalSurfaceView_onMultiTouchEventNative
03-16 23:19:23.833 21531 21531 E GraalGluon: Native Dalvik layer got touch event, passed to native Graal layer...
03-16 23:19:23.835 21531 21550 D GraalCompiled: traceEvent: Pushing TouchState[1,TouchState.Point[id=0,x=217,y=296]] to TouchPipeline[SmallMove]
03-16 23:19:23.835 21531 21550 D GraalCompiled: traceEvent: Applying SmallMove to TouchState[1,TouchState.Point[id=0,x=217,y=296]]
03-16 23:19:23.835 21531 21550 D GraalCompiled: traceEvent: Set TouchState[1,TouchState.Point[id=0,x=217,y=296]]
03-16 23:19:23.835 21531 21550 D GraalCompiled: traceEvent: Set MouseState[x=217,y=296,wheel=0,buttonsPressed=IntSet[212]]
03-16 23:19:23.849 21531 21531 V GraalActivity: Activity, get touch event, pcount = 1
03-16 23:19:23.850 21531 21531 E GraalGluon: Native Dalvik layer got touch event, pass to native Graal layer...
03-16 23:19:23.850 21531 21531 I GLASS   : Call InternalSurfaceView_onMultiTouchEventNative
03-16 23:19:23.850 21531 21531 E GraalGluon: Native Dalvik layer got touch event, passed to native Graal layer...
03-16 23:19:23.850  1371  2407 D InputReader: Input event(6): value=0 when=4704804369677000
03-16 23:19:23.850  1371  2407 D InputReader: Input event(6): value=0 when=4704804369677000
03-16 23:19:23.850  1371  2407 I InputReader: Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=] when=4704804369677000
03-16 23:19:23.851  1371  2406 I InputDispatcher: Delivering touch to (21531): action: 0x1, toolType: 1
03-16 23:19:23.852 21531 21550 D GraalCompiled: traceEvent: Pushing TouchState[1,TouchState.Point[id=0,x=217,y=296]] to TouchPipeline[SmallMove]
03-16 23:19:23.853 21531 21550 D GraalCompiled: traceEvent: Applying SmallMove to TouchState[1,TouchState.Point[id=0,x=217,y=296]]
03-16 23:19:23.853 21531 21550 D GraalCompiled: traceEvent: Set TouchState[1,TouchState.Point[id=0,x=217,y=296]]
03-16 23:19:23.855 21531 21531 V GraalActivity: Activity, get touch event, pcount = 1
03-16 23:19:23.856 21531 21531 E GraalGluon: Native Dalvik layer got touch event, pass to native Graal layer...
03-16 23:19:23.856 21531 21531 I GLASS   : Call InternalSurfaceView_onMultiTouchEventNative
03-16 23:19:23.856 21531 21531 E GraalGluon: Native Dalvik layer got touch event, passed to native Graal layer...
03-16 23:19:23.857 21531 21550 D GraalCompiled: traceEvent: Pushing TouchState[1,TouchState.Point[id=0,x=217,y=296]] to TouchPipeline[SmallMove]
03-16 23:19:23.857 21531 21550 D GraalCompiled: traceEvent: Applying SmallMove to TouchState[1,TouchState.Point[id=0,x=217,y=296]]
03-16 23:19:23.858 21531 21550 D GraalCompiled: traceEvent: Set TouchState[1,TouchState.Point[id=0,x=217,y=296]]
03-16 23:19:23.858 21531 21531 D ViewRootImpl@233d1ae[MainActivity]: ViewPostIme pointer 1
03-16 23:19:23.860 21531 21531 V GraalActivity: Activity, get touch event, pcount = 1
03-16 23:19:23.860 21531 21531 E GraalGluon: Native Dalvik layer got touch event, pass to native Graal layer...
03-16 23:19:23.860 21531 21531 I GLASS   : Call InternalSurfaceView_onMultiTouchEventNative
03-16 23:19:23.860 21531 21531 E GraalGluon: Native Dalvik layer got touch event, passed to native Graal layer...
03-16 23:19:23.861 21531 21550 D GraalCompiled: don't add points, primary = -1
03-16 23:19:23.861 21531 21550 D GraalCompiled: traceEvent: Pushing TouchState[0] to TouchPipeline[SmallMove]
03-16 23:19:23.861 21531 21550 D GraalCompiled: traceEvent: Applying SmallMove to TouchState[0]
03-16 23:19:23.861 21531 21550 D GraalCompiled: traceEvent: Set TouchState[0]
03-16 23:19:23.861 21531 21550 D GraalCompiled: traceEvent: Set MouseState[x=217,y=296,wheel=0,buttonsPressed=IntSet[]]
03-16 23:19:23.862 21531 21554 D GluonAttach: Initializing native position from OnLoad
03-16 23:19:23.862 21531 21554 D GraalGluon: ATTACH_DALVIK, tid = 21554, existed? 1, dalvikEnv at 0x7a803ed600
03-16 23:19:23.890 21531 21554 F zygote64: java_vm_ext.cc:504] JNI DETECTED ERROR IN APPLICATION: use of invalid jobject 0x7a72b29380
03-16 23:19:23.890 21531 21554 F zygote64: java_vm_ext.cc:504] "Thread-6" daemon prio=5 tid=14 Runnable
03-16 23:19:23.890 21531 21554 F zygote64: java_vm_ext.cc:504]   | group="main" sCount=0 dsCount=0 flags=0 obj=0x17f00000 self=0x7a8034e400
03-16 23:19:23.890 21531 21554 F zygote64: java_vm_ext.cc:504]   | sysTid=21554 nice=0 cgrp=default sched=0/0 handle=0x7a6d1ff4f0
03-16 23:19:23.890 21531 21554 F zygote64: java_vm_ext.cc:504]   | state=R schedstat=( 411261097 9035260 151 ) utm=28 stm=13 core=1 HZ=100
03-16 23:19:23.890 21531 21554 F zygote64: java_vm_ext.cc:504]   | stack=0x7a6d105000-0x7a6d107000 stackSize=1005KB
03-16 23:19:23.890 21531 21554 F zygote64: java_vm_ext.cc:504]   | held mutexes= "mutator lock"(shared held)
03-16 23:19:23.890 21531 21554 F zygote64: java_vm_ext.cc:504]   native: #00 pc 00000000003973ec  /system/lib64/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+212)
03-16 23:19:23.890 21531 21554 F zygote64: java_vm_ext.cc:504]   native: #01 pc 000000000045dba0  /system/lib64/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMapb+348)
03-16 23:19:23.890 21531 21554 F zygote64: java_vm_ext.cc:504]   native: #02 pc 00000000002d57b8  /system/lib64/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+1040)
03-16 23:19:23.890 21531 21554 F zygote64: java_vm_ext.cc:504]   native: #03 pc 00000000002d5d28  /system/lib64/libart.so (_ZN3art9JavaVMExt9JniAbortFEPKcS2_z+176)
03-16 23:19:23.890 21531 21554 F zygote64: java_vm_ext.cc:504]   native: #04 pc 0000000000462688  /system/lib64/libart.so (_ZNK3art6Thread13DecodeJObjectEP8_jobject+544)
03-16 23:19:23.890 21531 21554 F zygote64: java_vm_ext.cc:504]   native: #05 pc 0000000000107be4  /system/lib64/libart.so (_ZN3art11ScopedCheck13CheckInstanceERNS_18ScopedObjectAccessENS0_12InstanceKindEP8_jobjectb+116)
03-16 23:19:23.890 21531 21554 F zygote64: java_vm_ext.cc:504]   native: #06 pc 0000000000106840  /system/lib64/libart.so (_ZN3art11ScopedCheck5CheckERNS_18ScopedObjectAccessEbPKcPNS_12JniValueTypeE+856)
03-16 23:19:23.890 21531 21554 F zygote64: java_vm_ext.cc:504]   native: #07 pc 000000000010a468  /system/lib64/libart.so (_ZN3art8CheckJNI19GetMethodIDInternalEPKcP7_JNIEnvP7_jclassS2_S2_b+648)
03-16 23:19:23.890 21531 21554 F zygote64: java_vm_ext.cc:504]   native: #08 pc 0000000001629be4  /data/app/com.gps.demo-0NdG_lWfGchX6RZBHXarHg==/lib/arm64/libsubstrate.so (initializeDalvikHandles+316)
03-16 23:19:23.890 21531 21554 F zygote64: java_vm_ext.cc:504]   (no managed stack frames)
03-16 23:19:23.890 21531 21554 F zygote64: java_vm_ext.cc:504]

【问题讨论】:

  • 你能发布更完整的日志吗?它没有显示任何反映它挂起的东西?也可以使用Constants.ATTACH_DEBUG,甚至在positioning() 调用中添加一些打印输出。
  • @JoséPereda 我运行了一个限制较少的日志记录命令。 JNI 失败了。我还添加了打印,但我在日志中没有看到它们。 Constants.ATTACH_DEBUG 已从上一个问题设置为 true
  • 你在这个 JNI method 中遇到了崩溃,但我不能说为什么。您能否验证您是否从 JavaFX 应用程序线程调用该服务(使用 Platform.runLater)。顺便说一句,你测试过 HelloMaps 吗?这应该适合你开箱即用。如果有,请查看与您的应用有何不同。
  • @JoséPereda 我尝试使用Platform.runLater,没有改变任何东西。我测试了 HelloMaps,它在启动时也会出现黑屏。我必须将它复制到一个单独的项目中,以便我可以在 GitHub 上构建它 - github.com/nlisker/hello-maps2,如果您想自己尝试,还包含在 Actions(“Initial Commit”运行)下创建的 apk 工件。我在这里发布了完整的日志:pastebin.com/PVGUEmGL(第 292 行是 JNI 错误)。该服务是在视图加载之前加载的,因此与我之前的黑屏问题中的问题相同。
  • 好的,我已经设法重现了这个问题,甚至隔离了这个问题。提交了issuefixed

标签: java android gluon-mobile


【解决方案1】:

这是附加服务中的bug。它是 fixed,适用于 4.0.14 版本。

【讨论】:

    猜你喜欢
    • 2022-06-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-09
    • 1970-01-01
    • 1970-01-01
    • 2012-08-15
    相关资源
    最近更新 更多