Debug android-maven-plugin apps in Eclipse with DDMS

Lately, I’ve been developing Android applications with Maven support and, while it’s rather easy to mount a mature development environment with Eclipse, the usage of android-maven-plugin has brought some integration issues when debugging.

Usually, I do most of my Maven and debugging stuff in a terminal console. But others will prefer to use Eclipse! And I can understand why, since its DDMS perspective is so powerful and easy to use.  Here’s how you can do it:

  1. mvn clean package
  2. Deploy the target/xxx.apk to the device
  3. Open DDMS perspective in Eclipse
  4. Select the process you want to debug/trace
  5. There you go!

From profiling to thread debugging or simply adb logcat, you’ll have it all!

Don’t forget to configure permissions for your user to access the device. Ever hard those “?????” when issuing adb devices stating you have no permissions? Here’s how you can fix it (in Ubuntu-based distros at least):

  1. Run lsusb
  2. Check the line for your device, such as Bus 001 Device 008: ID 0bb4:0cab High Tech Computer Corp.
  3. Edit a new udev rule by executing sudo nano /etc/udev/rules.d/51-android.rules as seen bellow the bullet list
  4. Save file and issue sudo service udev restart
SUBSYSTEM==”usb”, SYSFS{idVendor}==”0bb4″, MODE=”0666
Reconnect your device and you’re done!

Debugging running APK in Eclipse DDMS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s