Run debugger on javaFX project in android

后端 未结 1 383
孤独总比滥情好
孤独总比滥情好 2020-12-22 05:55

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

相关标签:
1条回答
  • 2020-12-22 06:38

    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:

    0 讨论(0)
提交回复
热议问题