On-device debugging

On-device debugging (ODD) is an advanced and precise method for debugging mobile applications on the Symbian platform. In ODD, you debug a MIDlet directly on the target device using the debug features, such as breakpoints, of your chosen IDE. Currently, on-device debugging is only available for devices connected via WLAN, although devices can be connected via USB and Bluetooth for other diagnostic purposes.

In the Java ME environment, you can only debug your own MIDlets and their related memory and resource usage. The system resources are unavailable.

Figure: Debug session in Diagnostics window

Make sure to use the correct SDK for the same Symbian platform version that your test device has when debugging on a device. The SDK releases may have different versions of EcmtAgent included, which may cause problems with the IDE debug features.

Note: When EcmtAgent has been used for getting the device IP address, it also modifies the VM arguments. When the arguments have been changed, launching MIDlets normally does not work. For resetting the VM arguments, select the following option in EcmtAgent: Options -> WLAN Java ODD -> Disable Debug and close the EcmtAgent.

Prerequisites

Before starting on-device debugging, you need to build the required project and install the created JAR package onto the device.

  • Build the MIDlet project and deploy the created JAR package onto the device. On-device debugging requires having both the MIDlet installed on the device and having its project available in your chosen IDE (Eclipse or NetBeans).

  • Install EcmtAgent on your device according to instructions in section EcmtAgent.

Enabling ODD via WLAN

WLAN is the most stable and customizable connection in the mobile Java environment in regards to on-device debugging. When available, it should be your primary means for establishing ODD connections.

  1. Launch the EcmtAgent application on the device and set it to listen to WLAN connections by selecting WLAN in Options -> Settings -> Bearer. If you are not currently connected to the WLAN network, you are prompted to select the used connection.

    EcmtAgent should then notify you that it has acquired an IP address and is listening to WLAN connections. If an error message Engine error -18 is shown on the screen, it means that there are problems with the WLAN connection that you should resolve before continuing further.

    Figure: WLAN connection in EcmtAgent

  2. Open Options -> WLAN Java ODD and enter the IP address and port of your workstation. To determine your IP address on a Windows PC, type ipconfig in cmd.exe command shell.

    The port number can be freely chosen but is limited to four characters. To see the what ports are currently in use in your PC, type netstat -a in cmd.exe command shell, and avoid using those ports.

  3. Start the debugged MIDlet on the device. The device prompts a dialogue box saying that it is using modified VM arguments, followed by a WLAN connection request. Select the same WLAN network that your PC uses.

  4. Verify that your workstation is connected to the same WLAN network that the device based on the Symbian platform is using. To verify this, try to ping the device's IP address with the ping [device IP address] command in cmd.exe command shell.

For more information, see article How to configure Java ODD over WLAN with Eclipse and NetBeans IDEs

Launching debugger in Eclipse

If you are using Eclipse, select the correct project, and open the Debug Configurations window from Run -> Debug Configurations menu.

Figure: Setting debug configuration in Eclipse

Create a new Remote Java Application launch configuration. Enter the IP address of the device and the chosen port. When you are ready, click on Debug.

Launching debugger in NetBeans

If you are using NetBeans, select the Debug -> Attach debugger… menu option, which opens the following dialog window:

Figure: Setting debug configuration in NetBeans

Fill in the device IP address, port, and an adequate timeout. 60000 or more milliseconds is recommended. Click on OK.

After launching the debugger, the MIDlet should start on the device with the normal debugging features of the IDE in use.