how to debug a javafx application for android in eclipse - android

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?

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.

Related

android studio emulator won't start/show up

I'm new to Android/Kotlin programming (not to programming in general) and I'm following the Kotlin Basics course on developer.android.com.
The very first lesson after having installed Android Studio is to create a Virtual Device and run an extremely basic app on it.
However I can't get the emulator to work. The very first time I tried, it opened a small window with a progress bar but it became unresponsive at around 1/4 progress and I had to eventually kill it.
Since then it just won't start/open.
After I click run, the code compiles and the Event Log within Android Studio says Executing tasks[...] then Gradle build finished[...] and that's it. Nothing happens beyond that and the Emulator window says "No emulators are currently running".
However:
Some emulator-related processes have been started. Those processes stay alive even after closing Android Studio..
If I try to start the AVD from within the device manager, I get an error message that the device is already running
I am unable to delete these .lock files without killing the aforementioned processes
What I could find:
The Windows Event Viewer shows an Application Error
The Android Studio log file also shows an Error
I don't know what to do with either of these messages, though
What I tried
Killing the emulator processes, removing the *.lock files and trying again.
Creating a different AVD (different device, different version of Android)
Completely reinstalling Android Studio and the SDK following the accepted answer to this question: How to completely uninstall Android Studio from windows(v10)?.
None of this had any effect.
I'm running Android Studio Arctic Fox (2020.3.1 Patch 4) on Windows 10 Pro (10.0.19042 Build 19042).
I am able to run the app on my actual phone but down the line I would like to be able to test apps on different types of devices or without having to always use my physical one.
All help would be greatly appreciated.
By running and emulator.exe command in a command prompt, I was able to see yet another error message, the same one as in this post: emulator: incompatible HAX module version 3 requirs minimum version 4, and the answer to that post from user Harold Sota (as well as the comment under it from Harun, more specific to my situation) solved the issue.

Android App Made in Qt Not Launching

I am getting started with developing an application for Android using Qt 5.8 and am running into issues running a basic application. When I run a basic application on an Android emulator, the application fails to load and a lot of errors are printed to the Qt console. Text file of errors
Images of Qt Creator, emulator, and errors
I followed tutorials online on getting the Android development environment set up, and as far as I know, I have the SDK, the NDK, Java, and ant all set up correctly.
From "create a project" in Qt, I selected the Qt Quick Control Application, and set the kit for Androidx86 and desktop. I basically kept the application as it came, but added a teal background and two text fields, but didn't change any code.
When I run the program for desktop, it works fine and opens as shown with clickable buttons and typeable text fields. But when I try to deploy the application on any emulated Android application on 7.1, the emulator boots properly but the app that displays is just this.
The error messages that show up in the Qt Designer are and here is a file dump of the whole list of errors that showed up from trying to run the app.
I am unable to figure out what these errors mean, as I installed Qt and the android files according to the documentation but still encountered these errors and was hoping someone would know what the issue was?
Probably related to the service change or similar (QtActivity etc.) Please check the following link. (Bug fixed and resolved) Fix version: 5.7.0 RC
https://bugreports.qt.io/browse/QTBUG-52373

Debugging whilst developing JavaFX mobile application with gluon mobile plugin

I am new to javaFx and gluon mobile. In android studio there is the option to debug code whilst it is running on the phone and I was wondering if there is a similar feature for working with intelij and the gluon mobile plugin ? Under the gradle tasks there is a Debug task, which when clicked prints "Listening for transport dt_socket at address: 5005" to the console and waits. Unfortunately there is not a lot of documentation/examples regarding this that I could find. Any help is appreciated.
The Debug task is for desktop only.
It is intended to debug easily on your machine before deploying to mobile, but obviously it will allow tracking down only common issues, and that won't guarantee that the app will work on Android. I.e. using Streams will run on desktop and it will fail on Android.
To debug the app running on Android, the best way is using adb from your Android SDK folder, in the platform-tools folder.
Connect your app to the USB and run it. On a terminal go to that folder and run:
adb logcat -v threadtime
and search through all the messages trying to find out those related to the FXActivity.
You can add print outs in your code so you can easily track them in the logs.
There are other tools like the Android monitor (under Android sdk/tools folder), that will let you add some filters so you can easily go through the app messages.
First make sure you have enabled the Debugging Mode on your phone.
Then in Eclipse e.g., you can create a Debug Configuration of type Remote Java Application which will be attached to the corresponding socket:
You can get the port from the devices view:
Now you have to start your app first, and then start the Debug Configuration

running android emulator from worklight

I wish to run an application on android virtual device (I've created it). I right-click on the
Android project (which was created after I added the android environment) and choose "Run as Android Application". The emulator launches but it remains just a black window (and I wait a lot, nothing happens). Console writes "Build successful" and that's it. What might be the problem? API level is 18 (4.3). Platform Windows 7. Thanks.
Details: created a project, added hybrid application, added adaptors, deployed and run multiple times (just in browser), installed android in eclipse, added android environment, added AVD (had some old ones that didn't work, deleted them and created a new one following advises here).
It sounds like the problem is with your Android emulator.
First, can you start the emulator by itself, and see it work properly? You can start it from AVD itself. The emulator usually takes a long time to start, especially if you are running the ARM emulator instead of the x86 one.
If that works, can you run an empty Android app? You can go to File - New Project - Android Application Project, and after you create it, you should be able to run it and see an empty application.
If that works, can you try with an empty Worklight application? That way we can see if it is your specific application or something to do with Worklight.

Android development - can Eclipse / AVD run error free?

I am new to Android development and Eclipse. I have been given an Android app and asked to make some simple changes to it. I can build the project and run it in the emulator, but I see some errors in the LogCat window in Eclipse.
I put aside the app I was given and wrote the Hello World app, following the Hello World tutorial on developer.android.com. With this simple app, I was surprised to see many errors and stack dumps in the LogCat window. I closed Eclipse and re-launched it. After waiting for Eclipse to finish initializing, LogCat was empty. Then I started the Hello World app by clicking the run button. After a while entries appeared in LogCat, including many errors.
With such a simple app, copied from the tutorial, I am guessing the errors arise from the development environment and/or virtual device rather than from the app itself, but I would like to be able to run apps without errors.
Is it a reasonable expectation to be able to run Android apps from Eclipse on an AVD without any errors? Or is it the state of the art that the development environment logs many errors and dumps stack traces even when everything is running "normally"?
If it is reasonable, I will pursue each error until I have cleaned up my environment and application. I would prefer this, as I would then know that if errors appear as I continue development, they arise from my application and must be fixed. On the other hand, I can't spend months developing Eclipse and the Android SDK. If I have to learn to live with logs full of error messages, I'll just ignore them unless something crashes.
Note that the Hello World application runs as expected - it appears to be working despite the errors.
I am running Eclipse Indigo SR2 and Android SDK ??? (I don't see a version number for the SDK - the installer is r18 and SDK Manager says there are no updates available) on Windows 7 Professional, 64bit. I am testing with Android 4.0.3.
Use either:
adb com.your.package:v
or in log cat on the side button (You may need to make this visible by pressing the button with two rectangles in it in log cat) press the plus button and then add an application filter

Categories

Resources