how to debug a javafx application for android in eclipse

江枫思渺然 提交于 2020-01-07 04:08:05

问题


I create a big JavaFX application that works fine in desktop. In Android, its size is about 20 Mbytes.

Now, for deploying it for Android, I have installed Gluon (JavaFxPorts). With a small program (using the JavaFX transitions notions, timeline, ...), I have generated an .apk by calling the androidInstall gradle task. That works fine, except I cannot automatically install the .apk file in my phone. I do copy/paste from my desktop to my phone.

BUT, when I want to do the same process with my big application, at the end, my phone screen is already black.

Therefeore, even if this big application works fine on my desktop, it is necessary to debug it for Android on my desktop, too. But, I don't know how to? What to do with apkDebug gradle task, ..? gluon+gradle does not provide a kind of Android emulator that allows to finalize the debug on desktop for a smartphone with its specific features (size of screen, landscape orientation). Do you agree?

What is the additional tool that allows to do that?

Moreover,when the application is deployed in the smartphone, does it exist a tool that allows to finalize the debug on smartphone?

Thant you for your response

Note: I have installed Android SDK manager and its AVDM in Eclipse, but with the JavaFX use, it is impossible to use it, isn't it?


回答1:


Debugging JavaFX projects on Android so far doesn't work on Android emulators.

Command Line

The usual approach is just log messages to the console (i.e. System.out.println() or Log.v()...), and then using adb logcat.

On command line, go to your Android sdk folder, enter into the platform-tools folder and run adb logcat -v threadtime. That will give you all the log messages from your device, so you'll need to find your FXActivity pid there and filter through it.

Another possibility is using Android's monitor under the tools folder, a GUI tool that will allow filtering the console messages.

Eclipse

There is an ADT plugin for Eclipse, that can be installed following this question. This will allow you displaying logCat and device windows among others. Basically this will offer the same options as the monitor tool.

However, this doesn't seem to work with recent versions of logcat.

Android Studio

You can import your gradle project with Android Studio and enable the Android framework, so you can open the Android Monitor, and easily filter the logcat messages, or switch to the monitor tab with live charts of memory, cpu, ...

Black screen

Typically a black screen means you have some exception going on, so you need to use any of the above mentioned logging methods to track it down, solve it and try again.



来源:https://stackoverflow.com/questions/41075592/how-to-debug-a-javafx-application-for-android-in-eclipse

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