Debugging on an Android Mobile Phone

My OS on the PC is Ubuntu Lucid Lynx. My phone is a Samsung Galaxy S, it runs Android 2.1.

  1. Define an appropriate udev-rule. In my case I created a file  /etc/udev/rules.d/51-android.rules with the following content: SUBSYSTEM==“usb“, SYSFS{idVendor}==“04e8 „, SYSFS{idProduct}==“681c“, MODE=“0666″, OWNER=“myuser“. The vendor and the product id can be found by calling lsub.
  2. Now the usb service must be restarted: sudo service udev restart
  3. Go to the tools subdirectory in your androidsdk folder and restart the adb server: ./adb kill-server, ./adb start-server
  4. Switch on the usb-debugging on the mobile phone and connect the phone to the pc.
  5. If you now enter ./adb devices you should see your phone in the listing like the following:
    List of devices attached
    9000b9d40c16    device
  6. In your eclipse debug-configuration set the target selection to manual. This let you select your online device when you start your program for debugging.
  7. Don’t forget to set android:debuggable=“true“ in your application’s manifest!

That’s it. Now you can set breakpoints and watch the state of your application.

Leave a Reply

You must be logged in to post a comment.