Computer · Electronics&Communication

Connect HTC Desire for Developing and Debugging with Android SDK

http://bit.ly/ctwe2bNot long ago I just bought my new phone, HTC Desire – a very powerful android phone. And also not long ago I started learning on Android platform programming. I since then, I never try to run my application on my phone before.

Recently, I just want to see my program run on my phone. According to the Android Developer website ,if you using Eclipse IDE with Android Development Tools (ADT), what you need to do is;

1. Declare your application as “debuggable” in your Android Manifest.
Change “Debuggable” to true in Manifest ( Either in Application tab or adding android:debuggable="true" to            the <application> element in AndroidManifest.xml )

2. Turn on “USB Debugging” on your device.
On the device, go to the home screen, press MENU, select ApplicationsDevelopment, then enable USB                   debugging.

3. Make sure that you system have appropriate driver.

For the last step, they are quite tricky. The description is as follows:

For Ubuntu Linux, you need to add a rules file that contains a USB configuration for each type of device you want to use for development. Each device manufacturer uses a different vendor ID. The example rules files below show how to add an entry for a single vendor ID (the HTC vendor ID). In order to support more devices, you will need additional lines of the same format that provide a different value for the SYSFS{idVendor} property. For other IDs, see the table of USB Vendor IDs, below.

  1. Log in as root and create this file: /etc/udev/rules.d/51-android.rules.For Gusty/Hardy, edit the file to read:
    SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666" 

    For Dapper, edit the file to read:
    SUBSYSTEM=="usb_device", SYSFS{idVendor}=="0bb4", MODE="0666"

  2. Now execute:
    chmod a+r /etc/udev/rules.d/51-android.rules

For Mac OS X, it just works. Thanks to Steve Jobs.

For Windows, you need to install a USB driver for adb. See the Windows USB Driver documentation.

However, the Android Debug Bridge driver for Windows (I don’t sure about other platform) is ONLY SUPPORT several phone, which are T-Mobile G1, T-Mobile myTouch, Verizon Android, and Nexus One. The other phones not in this list are not support by ADB driver.

So in order to connect my HTC desire to Windows, I need to reconfigure ADB driver.

1. Open the android_winusb.inf file located in the /usb_driver folder on Android SDK

2. Find this line

[Google.NTx86]

3. Add the following line appending to the above line

;HTC Desire
%SingleAdbInterface%        = USB_Install, USB\VID_0BB4&PID_0C87
%CompositeAdbInterface%     = USB_Install, USB\VID_0BB4&PID_0C87&MI_01

4. Save the file. Your Windows should now recognize this driver and can install it as your phone usb driver.

If your phone are other phone rather than HTC Desire, you have to change the Hardware ID (e.g. USB\VID_0BB4&PID_0C87) to be your phone’s ID. You can get this ID by

1. Right-click on the My computer -> properties.

2. Click on Device Manager.

3. Find the ADB in the list on left-hand. (Should be some warning mark if you don’t have driver for it)

4. Right click on ADB -> Properties -> Detail

5. Change the drop-down box to Hardware ID. This is where your phone USB ID is keep. Use this ID to put in the android_winusb.inf as described above.

After all these steps, you should be able to test your own application on your mobile. Much more impressive than testing in Emulator, I assure.

Source:

http://developer.android.com/guide/developing/device.html#setting-up
http://www.flexjunk.com/2010/05/01/installing-htc-incredible-android-sd-drivers/
http://blog.jmedved.com/2010/06/android-debug-bridge-on-htc-android.html

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