Did you know? DZone has great portals for Python, Cloud, NoSQL, and HTML5!
Windows Phone Zone is brought to you in partnership with:

Den works on awesome stuff. He is a sophomore in college, a Microsoft MVP, a Microsoft Student Insider, a technical writer for DZone and a contributing author for Coding4Fun on Channel9. He is maintaining a number of open-source projects on CodePlex and GitHub. Den is a DZone Zone Leader and has posted 388 posts at DZone. You can read more from them at their website. View Full User Profile

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

09.08.2010
Email
Views: 8683
  • submit to reddit
It's so easy to get up and running with your first Windows Phone app!  Just pick up the FREE toolkit from Microsoft, register at AppHub, and start checking out some fundamental tutorials.

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.

Android

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.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

The Windows Phone Microzone, which is supported by Microsoft, is your one-stop-shop for news, tutorials, perspectives, and research on the mobile platform that is making waves in smartphone ecosystem.