Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Debugging Android: Using DDMS To Look Under The Hood

DZone's Guide to

Debugging Android: Using DDMS To Look Under The Hood

· Java Zone
Free Resource

Bitbucket is for the code that takes us to Mars, decodes the human genome, or drives your next car. What will your code do? Get started with Bitbucket today, it's free.

While working on an Android application recently, I ran into some problems, and was finding it difficult to work out what was actually going on in the emulator. As I'm using Appcelerator for my app development, I didn't have the luxury of using the built in Eclipse tools to find out what was wrong. Luckily for me, Google have a tool for this type of situation: the Dalvik Debug Monitor.

You can invoke the debug monitor from the tools directory of your android SDK install using the ddms command.

Here's a summary of what the tool provides: 

Process View

When you first open DDMS, you will see a list of emulators on the left hand side. Each of these has a number of associated VMs running. Click on any of these VMs and you can view their information on the right hand side, including the threads and VM heap information. You can force garbage collection on any of the VMs at anytime using the trash can toolbar button.

You can also control the state of the emulator on the right hand side using the Emulator Control tab.  Here you can change items such as the voice and data telephony status. This is useful if you need to simulate roaming. You can even call your emulator, providing a source phone number. This section also has local controls to help you simulate location services, passing in you location using manual coordinates, GPX or KML.

File Explorer

The file explorer was the reason I booted up the debug monitor in the first place; I needed to see if a particular file I was providing with my app was included in the final apk that I sent to the device. Not only does the file explorer allow you to browse the emulator, but you can also push and pull files from the device, as well as deleting.  You can even create an SD card image for use in the emulator. When you're confused about what's getting included in your app, the file explorer is the place to go.

Device Log

The pane along the bottom presents you with the device log. Obviously this is really useful, particularly if you are not seeing enough information in your development tool.

Of course, the best way to get to know the tool is by using it. If you need to use the debug monitor, you will have your own specific use case, just as I did. I'm really impressed with the level of control and information in this tool. It's already helped me out with some very tricky problems.

 

Bitbucket is the Git solution for professional teams who code with a purpose, not just as a hobby. Get started today, it's free.

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

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

{{ parent.tldr }}

{{ parent.urlSource.name }}