Run debugger on javaFX project in android

人走茶凉 提交于 2020-01-10 05:55:29

问题


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:

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.


回答1:


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

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. Create the JavaFX mobile app from your IDE

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. Create the apk

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

3. Open the app on your device

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

4. Open Android Device Monitor

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. Attach the debugger on your IDE

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. Run the debugger on your 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:



来源:https://stackoverflow.com/questions/44970567/run-debugger-on-javafx-project-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!