Run debugger on javaFX project in android - java

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.

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:

Related

my eclipse install another app instead of mine in emulator

I'm having a problem with my eclipse i have edited my app and it's ready with no error shows but now when i run it into my emulator it runs another app i have in my eclipse so i deleted the app and still i run the application i want in the eclipse and still it shows the old app that i didn't even ask to install it in my emulator so it's installing an app that i don't have at first place in my eclipse i don't know how it is possible i cleaned my project and still the problem is there and changed my emulator still its install the old app for me
uninstall the app from the emulator and check in your run configuration about the running app and try with new emulator
Be sure you have selected in package explorer the app you want to run. Try to unistall the app from the emulator or create a new device on emulator. Hope this help.
Check the Run configuration: Run->Run configuration. Under the Android tab, choose your project. If you run in Debug, you have similar option too.
Another similar case I saw, is that some application was installed, but the name was not updated. Verify the names of your application in both the strings.xml and the Manifest. (If you create a project by duplicating another one, it might be the problem).

android dev with hardware device, test app dosent run

Went on a 2 week vacation, forgot something trivial I think.
Im using eclipse for android development on ubuntu. Steps Ive taken :
Ive got adb running, and the device is properly detected. I have done kill-server and start-server numerous times.
I do have unknown sources and USB debugging checked on the device.
I start a new project (file -> new -> android project) and create the most basic android app. I dont modify any of the code. Target = Android 2.2. API = 8.
I choose Run -> run (Ctrl F11). The phone screen does not change. I expected a 'hello world' type message (thats created by the default code). I check the app drawer (is that what were calling that place with all the apps?) It is not in there.
I project -> clean, and stop / restart the server and try again with the same results.
There is nothing in logcat and only a (ignorable?) problem "Attribute minSdkVersion (15) is higher than the project target API level (8) AndroidManifest.xml /test_july10 line 1 Android ADT Problem"
Please help me from getting more gray hair.
Open your Run Configurations (You can right click on project name). Choose the Target tab and select "Always prompt to pick device". Click Apply.
Now try to run your app again. It should bring up a dialog box of available devices. Does your device show. If so choose it and run.
Open DDMS tab (Eclipse Perspective). Make sure your device shows in the list of devices, select it and click the LogCat tab below. Observe any Log messages, or add some to your code.

Make eclipse debug my android PROJECT

I am writing an Android application using Eclipse. When I click on the project in the left tree view and then click debug, the IDE builds an APK and installs in the emulator / device as expected.
However, if I'm editing a file and forget to first click on the project before attempting to debug, the IDE thinks I want to debug that specific Java file. This is NOT what I want to do, I would like it to build and emulate / install on device as usual.
Is there any way to change this behavior in Eclipse?
In eclipse, you can set in workspace preferences / run-debug / launching to always launch the previously launched application (until you explicitly choose an other application: then it will be the last that will be launched).
This way, no matter where you press (ctrl)F11 or click the debug/run button, the launch configuration you used the last time will be called again.
You will still be able to launch different applications of course, by explicitly calling their launchers (the way you debug now).
The procedure you are using (clicking on the project and selecting Debug as => Android Application is OK, for the first debug session (resp. Run as, non debug).
If you want to debug the app again (regardless of what is selected in the left hand side navigator), you should just click on the Green Run circular icon (or rather on the small > sign on its right side if you want to select a different run configuration) or the little bug on its left (for debug).
If you click on one of the > you will select on of the 8 last run/debugged app. If you are sure that the last one is the one you want to run again, then just press one of these two icons (bug for debug, green arrow for run) instead of the arrows.
When you click on the project and select Debug as what you actually do is configure a default run configuration for this app or class that can be later tweaked through the Run/debug Configurations... to better suit your customisation needs. If you click again, eclipse will detect that it has already generated a default configuration (and will not create a new identical one). Alternately you can directly create your new Run/Debug config directly through the Run/debug Configurations... sub menu.
Since the ADT plugin shipped by Google does not include a Run as... Android Application submenu when you click a java class under an android project, the default launch configuration is the java application or the server application (static main method absent).
Update
To clarify things a bit. What you ask (running your android app whilst having the java class selected in the package explorer is possible). What happens when you press the 'small bug' icon does not depend on what is selected in any navigator.
The "default launch configuration" is poorly phrased.
Let me describe what happens in more detail. When you right-click on a java class say in the package explorer (or the project explorer for Java EE version) eclipse (the navigator) calls all contributions (plugins) having registered a handler for that event and lists possible candidates in a sub menu.
In a standard Java EE eclipse installation you will see at least the run on server option and if the class has a main static method with string array arguments, you will also have a the runs as ... java application option. In both cases, eclipse will generate for you a "launch configuration". These launch configurations (both debug and non debug) are all available in the launcher dialog boxes (accessible via the icons described above). They have a lot of different configuration options depending on their nature (for instance whether you debug on a server or a simple java app or an applet). What I termed the "default configuration" is that for each of this launch configuration categories, eclipse will leave these options empty.
So the first time, you will select the Android project and select the run as... Android application option. This will create a default configuration. In ADT's case, the default configuration will also probably select a default ADV and launch it (if it's not already launched). And on subsequent occasions, it will be enough to press the run or debug icon to redeploy your app back to your ADV and this will happen regardless of what is selected in the navigator.

How can I launch more than one debug session in Eclipse from a single click?

I'm currently writing a GWT application through Eclipse. Eclipse is used for development but I use the m2eclipse plugin and a Maven pom.xml with the GWT plugin to build & run it.
When I need to debug the app I must:
Invoke "Run As ..." on a Maven project (via m2eclipse) "war:exploded gwt:debug". This launches GWT's app server and waits for a remote debug connection on port 3408. The need to wait for the WAR to be exploded means it could be a minute for this to happen.
Invoke "Debug As..." a Remote Java Application to connect to the server.
I've already added both targets to favourites to lock them into the drop down but it's still a pain.
I'd like to launch them both in sequence from a single click rather than two discrete actions.
Is there any way in Eclipse to achieve this?
Try this plugin. http://marketplace.eclipse.org/content/escripts
You can define scripts of Eclipse actions easily. You create a script of starting the 2 debug session, then run with one click or shortcut.
EDIT:
The plugin was moved and is now called EASE.
https://eclipse.org/ease/
"Launch Groups" are part of the CDT. Officially supported, easy to install.
See https://stackoverflow.com/a/11905444/518491
Why are you launching like this? Can't you just launch it by GWT plugin? Go to Run Configurations -> Web Application (the blue circle with "g" inside) and create new Run Configuration.
In it, in Main tab, enter (or select) your project, and enter com.google.gwt.dev.DevMode in Main class.
In Arguments enter -remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -port 8888 -war path_to_your_dir_with_WEB-INF_directory com.package.your.Module

Android Emulator not loading on netbeans

I just downloaded the android sdk from the adnroid site and followed this tutorial to set it up on netbeans. Everything to seem to have installed fine but whenever i try to run the application this window pops up:
alt text http://img80.imageshack.us/img80/4327/androidemulator.png
What I am assuming it asking me to choose the emulator, but it is not showing up on the list. Is there a reason why?
I don't use netbeans, but it looks like you don't have any AVD's created, and if you do, then there is probably a way to associate them that you are missing in netbeans. You can check here to create an AVD http://developer.android.com/guide/developing/tools/avd.html
But I would just use eclipse if possible, the integration works really well, and it was written to run in eclipse, so there are less issues and hurdles.
Also see Running Your Application section of http://developer.android.com/guide/developing/other-ide.html that will describe how to launch the app from the tools outside of the IDE.
I have the same problem with you. But i have my emulator works now.
Are you have to do is running your Android SDK Manager, then click Virtual devices, and Make new AVD device.
Click New. Then fill name, and select Target (Platform of your Android), Skin, and hardware.
Then click Create AVD to finish.
Now you have device to choose. :)
go in C:\Program Files\Android\android-sdk\SDK Manager.exe and create the virtual device. After it appear in device list.
Thats it.
Open Sdk manager
Tool Manage AVD
Select and start AVD. wait open.
Goto netbean Run project.
U must see project run in AVD.
Success..
The article at the link #broschb had posted is explaining how to create an AVD using command line. Do exactly what is says there (it's very easy). Once you have created the AVD it will appear in the AVD list in Netbeans. Actually, if you have only one AVD it will start by default when you run your app.
run the avd manager which is location in the android-sdk folder and then create a new avd,but be sure you have already downloaded ARM EABI system image tool set.
Just create avd (android virtual device) and run it..
like android -avd "name of your avd"
Then try to run your application.
It will ask you to select the virtual device that you have started above.
Thats it.

Categories

Resources