Android and Windows Phone 7 - Part 3 – Debugging on the device

DZone 's Guide to

Android and Windows Phone 7 - Part 3 – Debugging on the device

· ·
Free Resource

If you are developing applications for a specific mobile platform, you will eventually feel the need to debug on an actual device.

Windows Phone 7

Currently, only a limited number of developers have the actual Windows Phone 7 device, therefore it is hard to say how the debugging experience is on the actual hardware.

When you are working on a Windows Phone 7 application, the debugging process is handled via a special release of the Zune software that detects and manages the connected Windows Phone 7 device. Currently it is only available to Microsoft employees and some developers in the United States that obtained WP7 devices for testing purposes. I would highly recommend taking a look at Shawn Wildermuth’s “Debugging on the Phone” blog post that describes the overall debug experience on the phone. Overall, it looks like there is no performance loss compared to debugging inside the emulator. Also, you can directly access hardware that is not otherwise accessible through the emulator – for example, the accelerometer.


When you want to debug an application directly on Android, the first thing you have to do is prepare the device. In Settings, go to Application settings and select Development. Make sure that the USB debugging option is enabled.

Now you can connect the phone to the development machine. If this is the first time you are connecting the device, Windows (as you probably know, unless otherwise mentioned I am using a Windows machine for development) will start installing device drivers for your phone.

I was testing this with my Motorola Backflip (running Android OS 1.5) and here is what I got when I connected the device to the PC:

By default, the ADB (Android Debug Bridge) interface is not installed and you will have to find it on your own - specific to the device you are using. Once you install the proper drivers, you are readyto go. 

Launch Eclipse and create a sample Android application. Make sure that you are targetting the correct platform, since if, for example, you will select a version higher than the one used by your device, it will not be detected and you won't be able to lauch the debug session.

Right click on the project in the sidebar and select Properties.


Once you see the Properties dialog, select Run/Debug settings:

Select the current configuration and click on Edit. In the dialog that appears, select the Target tab and select the Manual option for Deployment Target Selection Mode.

Make sure that device is connected and click on Run. You will be prompted with a dialog that will ask you to select a debug target. If the driver is properly installed and device detected, you will see it listed:


Select the device and click OK. Now, the application should be installed on your device. You can see if it's there by checking the list of installed applications:


Once installed, you are able to track down it's progress and work with the help of DDMS (Dalvik Debug Monitor) that is bundled with the SDK and located in the tools folder.


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}