在android中的javaFX项目上运行调试器 [英] Run debugger on javaFX project in android

查看:158
本文介绍了在android中的javaFX项目上运行调试器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在android上重建旧的javafx项目。目前我正在使用javafxports这样做。问题是我无法调试它,这就是项目层次结构的外观:

I am trying to rebuild an old javafx project on android. Currently I am using javafxports to do so. The problem is I can't debug it, this is how the project hierarchy looks:

该应用程序从 DisplayClient 开始。到目前为止,我可以使用设备监视器记录消息。你能否告诉我是否可以附加一个调试器,如果是这样的话?如果需要任何进一步的信息,我很乐意给它。

The application is started from DisplayClient. So far I am able to log messages using the device monitor. Can you please tell me if it is possible to attach a debugger and if it is how? If any further information is needed I would be happy to give it.

推荐答案

您可以轻松地将调试器连接到IntelliJ IDE在Android设备上运行您的应用。

You can easily attach a debugger to your IntelliJ IDE while running your app on an Android device.

调试您使用IDE的Gluon插件(NetBeans,IntelliJ或Eclipse)创建的JavaFXPorts / Gluon Mobile,以及您已部署到Android设备,请按以下步骤操作:

To debug a JavaFXPorts/Gluon Mobile that you have created using the Gluon plugin for your IDE (NetBeans, IntelliJ or Eclipse), and that you have deployed to the Android device, follow these steps:

1。从IDE创建JavaFX移动应用程序

为此,您可以使用IDE的Gluon插件。使用其中一个内置模板来创建项目,或者使用此处提供的众多示例之一。

For that you can use the Gluon plugin for your IDE. Use one of the built-in templates to create your project or go and use one of the many samples available here.

假设您使用的是单视图项目。提供名称并运行应用程序

Let's say you use the Single View project. Provide a name and run the app

2。创建apk

从Gradle视图运行任务任务 - >其他 - > AndroidInstall 创建apk(或在命令行上运行./gradlew android)。

Run the task from the Gradle View Tasks->other->AndroidInstall to create the apk (or on command line run ./gradlew android).

3。在您的设备上打开该应用

确保该应用适用于您的设备,并且不要将其关闭。

Make sure the app works on your device, and don't close it.

4。打开Android设备监视器

转到< android sdk> / tools 并运行监测。在左侧,您应该看到设备和进程列表。在那里找到你的应用程序包名称,选择它并查看它用于应用程序的端口(8600)。

Go to <android sdk>/tools and run monitor. On the left, on top you should see the device, and a list of processes. Find your app package name there, select it and see the port it is using for the app (8600).

5。在IDE上附加调试器

最后,返回IDE,并使用localhost和8600端口连接远程调试器。对于IntelliJ IDE,请转到运行 - >编辑配置... ,在左上角单击 + ,选择Remote选项,并提供一个名称(远程调试器)和端口:

Finally, go back to your IDE, and attach the remote debugger, with localhost and 8600 port. For the IntelliJ IDE, go to Run->Edit Configurations..., on the upper left click +, select the Remote option, and provide a name (remote debugger), and the port:

6。在IDE上运行调试器

单击确定保存,在代码中添加一些断点,然后运行调试器。

Click ok to save, add some breakpoint to your code, and now run the debugger.

在这种情况下,我在按钮事件处理程序中有一个断点,所以当我点击它时,应用程序在断点处停止:

In this case, I have a breakpoint in the button event handler, so when I click on it, the app halts at the breakpoint:

这篇关于在android中的javaFX项目上运行调试器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆