Saturday, December 19, 2009

Debugging an application on the device

By far the best way to program for android is with a device. It is faster and easier to do.

To get to this point, there are a couple of things I needed to do.

The first was to get my device ready to host and debug and application. This guide:



  • On the device, go to the home screen, press MENU, select Applications > Development, then enable USB debugging.


  • Setup linux to detect the device. For myself, I added the following to /etc/udev/rules.d/51-android.rules:

    SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"


    Note (you might need to use SUBSYSTEM="udb_device" depending on what version of ubuntu you are using).
    And then:

    chmod a+r /etc/udev/rules.d/51-android.rules



  • execute adb devices. If this doesn't work, you might need to do the following:

    sudo su -
    adb kill-server
    adb start-server
    adb devices




Once you have done this, you should be able to run the application from eclipse.

NOTE: You must remember to enable debugging in the Android Mainfest. This is under the 'Application' tab of the manifest under eclipse.

NOTE: The above was all done with ubuntu 9.10 running eclipse 4.5.1.

No comments: